This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients brett.cannon, eric.snow, miss-islington, ncoghlan, ned.deily, ronaldoussoren, vstinner
Date 2018-09-20.13:42:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537450939.58.0.956365154283.issue34247@psf.upfronthosting.co.za>
In-reply-to
Content
> The "ill-defined" in Python 3.6 relates to the fact that we never actually defined or tested which environment variables were read by Py_Main and which ones were read by Py_Initialize, since the majority of our tests only covered Py_Main (by launching a full Python subprocess).
>
> Thus the only way to find out which environment variables fell into which category would be to read the Python 3.6 source code.

Oh ok, I see. Thanks for the explanation.

> That's technically still the case for Python 3.7, but Victor's done some excellent refactoring work so it's much clearer in the code which vars may be updated if Py_Initialize is run a second time.

Well, for me the most important part is not the code, but tests. test_embed currently tests the following environment variables:

static void test_init_env_putenvs(void)
{
    putenv("PYTHONHASHSEED=42");
    putenv("PYTHONMALLOC=malloc_debug");
    putenv("PYTHONTRACEMALLOC=2");
    putenv("PYTHONPROFILEIMPORTTIME=1");
    putenv("PYTHONMALLOCSTATS=1");
    putenv("PYTHONUTF8=1");
    putenv("PYTHONVERBOSE=1");
    putenv("PYTHONINSPECT=1");
    putenv("PYTHONOPTIMIZE=2");
    putenv("PYTHONDONTWRITEBYTECODE=1");
    putenv("PYTHONUNBUFFERED=1");
    putenv("PYTHONNOUSERSITE=1");
    putenv("PYTHONFAULTHANDLER=1");
    putenv("PYTHONDEVMODE=1");
    /* FIXME: test PYTHONWARNINGS */
    /* FIXME: test PYTHONEXECUTABLE */
    /* FIXME: test PYTHONHOME */
    /* FIXME: test PYTHONDEBUG */
    /* FIXME: test PYTHONDUMPREFS */
    /* FIXME: test PYTHONCOERCECLOCALE */
    /* FIXME: test PYTHONPATH */
}

As you can see, the test suite is not complete yet. But since the tests are there, it shouldn't be hard to extend the test suite.

test_embed has InitConfigTests in 3.7 and master branches. I'm not interested to backport these tests to 3.6. I modified Python initialization deeply in 3.7, and the status of the code in 3.6 is "undefined". I don't think that it's worth it to backport these tests to 2.7 or 3.6. I success to focus on the master branch where we want to finish the implementation of the PEP 432 which should provide a better *public* API for that.
History
Date User Action Args
2018-09-20 13:42:19vstinnersetrecipients: + vstinner, brett.cannon, ronaldoussoren, ncoghlan, ned.deily, eric.snow, miss-islington
2018-09-20 13:42:19vstinnersetmessageid: <1537450939.58.0.956365154283.issue34247@psf.upfronthosting.co.za>
2018-09-20 13:42:19vstinnerlinkissue34247 messages
2018-09-20 13:42:19vstinnercreate