osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] New _Py_InitializeFromConfig() function (PEP 432)


2018-08-02 1:18 GMT+02:00 Eric Snow <ericsnowcurrently at gmail.com>:
> Backporting shouldn't be so risky since it's all private API and there
> are few other changes in the relevant code since 3.7, right?  It
> depends on if Ned's okay with it or not. :)

I'm still doing further bug fixes and cleanup in the master branch:
https://bugs.python.org/issue34170

I'm doing more and more changes. I just added two new files:
Include/coreconfig.h and Python/coreconfig.h. IMHO it's better to put
similar code in separated files.

FYI Python/coreconfig.c has 954 files and Include/coreconfig.h has 319 lines.

I'm ok to rename the structure and the files if you prefer a different name.

About that, I'm working on a subproject: abandon Py_xxx global
configuration variables to replace them with accessing
interpreter->core_config->xxx. I'm not sure yet if it's a good idea or
not, but it would allow to have two interpreters to have their own
different configuration. Imagine two interpreters with different
sys.path running in isolated mode. Or maybe an interpreter without
importlib?

One of the issue is that we have now two copies of the same option.
For example, Py_BytesWarningFlag and
interpreter->core_config->bytes_warning. That's why I would like to
switch to core_config.

But I'm also trying to make sure that the two variables have the same value:
https://github.com/python/cpython/commit/a4d20b2e5ece2120f129cb4dda951a6c2461e92d

Victor