bpo-34247: actually use environment variables in Py_Initialize by ronaldoussoren · Pull Request #8521 · python/cpython (original) (raw)

As mentioned in bpo-34247 a program embedding Python with Py_Initialize / Py_Run... (no Py_Main) cannot affect a number of interpreter options through environment variables.

This is a pull request against the 3.7 branch, primarily because Nick Coghlan mentioned that there is related work on the master branch by Victor Stinner (bpo-34170).

The patch works for me, but I haven't dug deeply enough in the code to be sure that this is the right patch, I'm particularly unsure about the additional argument to _PyCoreConfig_Read.

https://bugs.python.org/issue34247