diff options
| author | Victor Stinner <vstinner@redhat.com> | 2019-03-23 11:05:43 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-23 11:05:43 (GMT) |
| commit | 6d5ee973f0600a3a9444f569dcf0dd346bfa2a11 (patch) | |
| tree | d10610b71d1dbff047e5ed912d82bff298e45537 /Python/preconfig.c | |
| parent | 2b75155590eb42d25e474b776ee9fdcc4b3dc840 (diff) | |
| download | cpython-6d5ee973f0600a3a9444f569dcf0dd346bfa2a11.zip cpython-6d5ee973f0600a3a9444f569dcf0dd346bfa2a11.tar.gz cpython-6d5ee973f0600a3a9444f569dcf0dd346bfa2a11.tar.bz2 | |
bpo-36301: Add _PyRuntimeState.preconfig (GH-12506)
_PyPreConfig_Write() now writes the applied pre-configuration into
_PyRuntimeState.preconfig.
Diffstat (limited to 'Python/preconfig.c')
| -rw-r--r-- | Python/preconfig.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Python/preconfig.c b/Python/preconfig.c index d856c12..13e5e1e 100644 --- a/Python/preconfig.c +++ b/Python/preconfig.c @@ -862,5 +862,14 @@ _PyPreConfig_Write(_PyPreConfig *config) /* Set LC_CTYPE to the user preferred locale */ _Py_SetLocaleFromEnv(LC_CTYPE); + /* Write the new pre-configuration into _PyRuntime */ + PyMemAllocatorEx old_alloc; + _PyMem_SetDefaultAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + int res = _PyPreConfig_Copy(&_PyRuntime.preconfig, config); + PyMem_SetAllocator(PYMEM_DOMAIN_RAW, &old_alloc); + if (res < 0) { + return _Py_INIT_NO_MEMORY(); + } + return _Py_INIT_OK(); } |
