]> granicus.if.org Git - python/commit
bpo-36763: Add _PyCoreConfig_InitPythonConfig() (GH-13388)
authorVictor Stinner <vstinner@redhat.com>
Fri, 17 May 2019 17:01:14 +0000 (19:01 +0200)
committerGitHub <noreply@github.com>
Fri, 17 May 2019 17:01:14 +0000 (19:01 +0200)
commitcab5d0741ee6adf2ae9ff5aaafe06b75b4b5bca3
tree745b2e08f4a035ffb345e695216934b1a3b6ccda
parentb16b4e45923f4e4dfd8e970ae4e6a934faf73b79
bpo-36763: Add _PyCoreConfig_InitPythonConfig() (GH-13388)

Add new functions to get the Python interpreter behavior:

* _PyPreConfig_InitPythonConfig()
* _PyCoreConfig_InitPythonConfig()

Add new functions to get an isolated configuration:

* _PyPreConfig_InitIsolatedConfig()
* _PyCoreConfig_InitIsolatedConfig()

Replace _PyPreConfig_INIT and _PyCoreConfig_INIT with new functions
_PyPreConfig_Init() and _PyCoreConfig_Init().

_PyCoreConfig: set configure_c_stdio and parse_argv to 0 by default
to behave as Python 3.6 in the default configuration.

_PyCoreConfig_Read() no longer sets coerce_c_locale_warn to 1 if it's
equal to 0. coerce_c_locale_warn must now be set to -1 (ex: using
_PyCoreConfig_InitPythonConfig()) to enable C locale coercion
warning.

Add unit tests for _PyCoreConfig_InitPythonConfig()
and _PyCoreConfig_InitIsolatedConfig().

Changes:

* Rename _PyCoreConfig_GetCoreConfig() to _PyPreConfig_GetCoreConfig()
* Fix core_read_precmdline(): handle parse_argv=0
* Fix _Py_PreInitializeFromCoreConfig(): pass coreconfig.argv
  to _Py_PreInitializeFromPyArgv(), except if parse_argv=0
12 files changed:
Include/cpython/coreconfig.h
Include/internal/pycore_coreconfig.h
Lib/test/test_embed.py
Modules/main.c
Programs/_freeze_importlib.c
Programs/_testembed.c
Python/coreconfig.c
Python/frozenmain.c
Python/pathconfig.c
Python/preconfig.c
Python/pylifecycle.c
Python/pystate.c