STINNER Victor <vstin...@redhat.com> added the comment:

> 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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34247>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to