summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_embed.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-29778: Ensure python3.dll is loaded from correct locations when Python ↵Miss Islington (bot)2020-07-061-7/+24
| | | | | | | | | is embedded (GH-21297) (GH-21352) Also enables using debug build of `python3_d.dll` Reference: CVE-2020-15523 (cherry picked from commit dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-41094: Additional fix for PYTHONSTARTUP. (GH-21119)Miss Islington (bot)2020-06-241-2/+2
| | | | | (cherry picked from commit a7dc71470156680f1fd5243290c6d377824b7ef4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41094: Fix decoding errors with audit when open files. (GH-21095)Miss Islington (bot)2020-06-241-2/+2
| | | | | (cherry picked from commit 6c6810d98979add7a89391c3c38990d0859f7a29) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)Miss Islington (bot)2019-09-291-2/+26
| | | | | | | | | | | | Fix warnings options priority: PyConfig.warnoptions has the highest priority, as stated in the PEP 587. * Document options order in PyConfig.warnoptions documentation. * Make PyWideStringList_INIT macro private: replace "Py" prefix with "_Py". * test_embed: add test_init_warnoptions(). (cherry picked from commit fb4ae152a9930f0e00cae8b2807f534058cf341a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* [3.8] bpo-38234: Backport init path config changes from master (GH-16423)Victor Stinner2019-09-261-20/+322
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bpo-38234: Py_SetPath() uses the program full path (GH-16357) Py_SetPath() now sets sys.executable to the program full path (Py_GetProgramFullPath()), rather than to the program name (Py_GetProgramName()). Fix also memory leaks in pathconfig_set_from_config(). (cherry picked from commit 1ce152a42eaa917d7763bce93f1e1ca72530d7ca) * bpo-38234: Add tests for Python init path config (GH-16358) (cherry picked from commit bb6bf7d342b4503a6227fd209fac934905b6a1aa) * bpo-38234: test_embed: test pyvenv.cfg and pybuilddir.txt (GH-16366) Add test_init_pybuilddir() and test_init_pyvenv_cfg() to test_embed to test pyvenv.cfg and pybuilddir.txt configuration files. Fix sysconfig._generate_posix_vars(): pybuilddir.txt uses UTF-8 encoding, not ASCII. (cherry picked from commit 52ad33abbfb6637d74932617c7013bae0ccf6e32) * bpo-38234: Cleanup getpath.c (GH-16367) * search_for_prefix() directly calls reduce() if found is greater than 0. * Add calculate_pybuilddir() subfunction. * search_for_prefix(): add path string buffer for readability. * Fix some error handling code paths: release resources on error. * calculate_read_pyenv(): rename tmpbuffer to filename. * test.pythoninfo now also logs windows.dll_path (cherry picked from commit 221fd84703c545408bbb4a6e0b58459651331f5c) * bpo-38234: Fix test_embed pathconfig tests (GH-16390) bpo-38234: On macOS and FreeBSD, the temporary directory can be symbolic link. For example, /tmp can be a symbolic link to /var/tmp. Call realpath() to resolve all symbolic links. (cherry picked from commit 00508a7407d7d300b487532e2271534b20e378a7) * bpo-38234: Add test_init_setpath_config() to test_embed (GH-16402) * Add test_embed.test_init_setpath_config(): test Py_SetPath() with PyConfig. * test_init_setpath() and test_init_setpythonhome() no longer call Py_SetProgramName(), but use the default program name. * _PyPathConfig: isolated, site_import and base_executable fields are now only available on Windows. * If executable is set explicitly in the configuration, ignore calculated base_executable: _PyConfig_InitPathConfig() copies executable to base_executable. * Complete path config documentation. (cherry picked from commit 8bf39b606ef7b02c0279a80789f3c4824b0da5e9) * bpo-38234: Complete init config documentation (GH-16404) (cherry picked from commit 88feaecd46a8f427e30ef7ad8cfcddfe392a2402) * bpo-38234: Fix test_embed.test_init_setpath_config() on FreeBSD (GH-16406) Explicitly preinitializes with a Python preconfiguration to avoid Py_SetPath() implicit preinitialization with a compat preconfiguration. Fix also test_init_setpath() and test_init_setpythonhome() on macOS: use self.test_exe as the executable (and base_executable), rather than shutil.which('python3'). (cherry picked from commit 49d99f01e6e51acec5ca57a02e857f0796bc418b) * bpo-38234: Py_Initialize() sets global path configuration (GH-16421) * Py_InitializeFromConfig() now writes PyConfig path configuration to the global path configuration (_Py_path_config). * Add test_embed.test_get_pathconfig(). * Fix typo in _PyWideStringList_Join(). (cherry picked from commit 12f2f177fc483723406d7917194e7f655a20631b)
* bpo-36763: PyConfig_Read() handles PySys_AddXOption() (GH-15431) (GH-15435)Victor Stinner2019-08-231-0/+17
| | | | | | | | | | | | PyConfig_Read() is now responsible to handle early calls to PySys_AddXOption() and PySys_AddWarnOption(). Options added by PySys_AddXOption() are now handled the same way than PyConfig.xoptions and command line -X options. For example, PySys_AddXOption(L"faulthandler") enables faulthandler as expected. (cherry picked from commit 120b707a6d43452e067daa55a8fdca69f9424abc)
* bpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)Miss Islington (bot)2019-08-231-6/+10
| | | | | (cherry picked from commit 3842f2997fbd4dc840986aad2bb94656815e243b) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37363: Add audit events on startup for the run commands (GH-14524)Miss Islington (bot)2019-07-011-4/+36
| | | | | (cherry picked from commit e226e83d36dfc7220d836fb7a249ce18e70cb4a6) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-36763: Use PyConfig_Clear() (GH-14445)Miss Islington (bot)2019-07-011-3/+12
| | | | | | | | Stop using "static PyConfig", PyConfig must now always use dynamically allocated strings: use PyConfig_SetString(), PyConfig_SetArgv() and PyConfig_Clear(). (cherry picked from commit 67310023f299b5a2fad71fca449b46d280036690) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* Remove unused imports in tests (GH-14518) (GH-14520)Victor Stinner2019-07-011-1/+0
| | | (cherry picked from commit 8f4ef3b019ce380022018587571b0f970e668de3)
* bpo-37369: Fix initialization of sys members when launched via an app ↵Steve Dower2019-06-291-7/+10
| | | | | | container (GH-14467) sys._base_executable is now always defined on all platforms, and can be overridden through configuration. Also adds test.support.PythonSymlink to encapsulate platform-specific logic for symlinking sys.executable
* Fix test_embed.test_pre_initialization_sys_options() env vars (GH-14172)Miss Islington (bot)2019-06-171-6/+12
| | | | | | | test_pre_initialization_sys_options() of test_embed now removes PYTHON* environment variables like PYTHONWARNINGS. (cherry picked from commit dbdc991a62bc2b3393d287e90292e3603f47d98a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-36763: Implement the PEP 587 (GH-13592)Victor Stinner2019-05-271-78/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a whole new documentation page: "Python Initialization Configuration" * PyWideStringList_Append() return type is now PyStatus, instead of int * PyInterpreterState_New() now calls PyConfig_Clear() if PyConfig_InitPythonConfig() fails. * Rename files: * Python/coreconfig.c => Python/initconfig.c * Include/cpython/coreconfig.h => Include/cpython/initconfig.h * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h * Rename structures * _PyCoreConfig => PyConfig * _PyPreConfig => PyPreConfig * _PyInitError => PyStatus * _PyWstrList => PyWideStringList * Rename PyConfig fields: * use_module_search_paths => module_search_paths_set * module_search_path_env => pythonpath_env * Rename PyStatus field: _func => func * PyInterpreterState: rename core_config field to config * Rename macros and functions: * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv() * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv() * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString() * _PyInitError_Failed() => PyStatus_Exception() * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx * _Py_UnixMain() => Py_BytesMain() * _Py_ExitInitError() => Py_ExitStatusException() * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs() * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs() * _Py_PreInitialize() => Py_PreInitialize() * _Py_RunMain() => Py_RunMain() * _Py_InitializeFromConfig() => Py_InitializeFromConfig() * _Py_INIT_XXX() => _PyStatus_XXX() * _Py_INIT_FAILED() => _PyStatus_EXCEPTION() * Rename 'err' PyStatus variables to 'status' * Convert RUN_CODE() macro to config_run_code() static inline function * Remove functions: * _Py_InitializeFromArgs() * _Py_InitializeFromWideArgs() * _PyInterpreterState_GetCoreConfig()
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-0/+11
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36763: Fix _PyPreConfig_InitCompatConfig() utf8_mode (GH-13518)Victor Stinner2019-05-231-4/+34
| | | | | | | | | | * _PyPreConfig_InitCompatConfig() sets utf8_mode to 0. * Change Py_UTF8Mode default value to 0. * Fix _PyPreConfig_Copy(): copy also _config_init attrbibute. * _PyPreConfig_AsDict() exports _config_init * Fix _PyPreConfig_GetGlobalConfig(): use Py_UTF8Mode if it's greater than 0, even if utf8_mode >= 0. * Add unit tests on environment variables using Python API.
* bpo-36763: Rename private Python initialization functions (GH-13511)Victor Stinner2019-05-221-31/+34
| | | | | | | | | | | * Rename private C functions: * _Py_Initialize_ReconfigureCore => pyinit_core_reconfigure * _Py_InitializeCore_impl => pyinit_core_config * _Py_InitializeCore = > pyinit_core * _Py_InitializeMainInterpreter => pyinit_main * init_python => pyinit_python * Rename _testembed.c commands: add "test_" prefix.
* bpo-36763: Add _PyPreConfig._config_init (GH-13481)Victor Stinner2019-05-221-49/+64
| | | | | | | | | | | | | | | | | | | * _PyPreConfig_GetGlobalConfig() and _PyCoreConfig_GetGlobalConfig() now do nothing if the configuration was not initialized with _PyPreConfig_InitCompatConfig() and _PyCoreConfig_InitCompatConfig() * Remove utf8_mode=-2 special case: use utf8_mode=-1 instead. * Fix _PyPreConfig_InitPythonConfig(): * isolated = 0 instead of -1 * use_environment = 1 instead of -1 * Rename _PyConfig_INIT to _PyConfig_INIT_COMPAT * Rename _PyPreConfig_Init() to _PyPreConfig_InitCompatConfig() * Rename _PyCoreConfig_Init() to _PyCoreConfig_InitCompatConfig() * PyInterpreterState_New() now uses _PyCoreConfig_InitPythonConfig() as default configuration, but it's very quickly overriden anyway. * _freeze_importlib.c uses _PyCoreConfig_SetString() to set program_name. * Cleanup preconfig_init_utf8_mode(): cmdline is always non-NULL.
* bpo-36763: Fix encoding/locale tests in test_embed (GH-13443)Victor Stinner2019-05-201-87/+103
| | | | | * Fix encoding and locale tests in test_embed.InitConfigTests. * InitConfigTests now only computes EXPECTED_CONFIG once. * Add tests for PYTHONWARNINGS and PYTHONPATH env vars
* bpo-36763: Fix Python preinitialization (GH-13432)Victor Stinner2019-05-201-22/+74
| | | | | | | | | | | | | | | | | | | | | * Add _PyPreConfig.parse_argv * Add _PyCoreConfig._config_init field and _PyCoreConfigInitEnum enum type * Initialization functions: reject preconfig=NULL and config=NULL * Add config parameter to _PyCoreConfig_DecodeLocaleErr(): pass config->argv to _Py_PreInitializeFromPyArgv(), to parse config command line arguments in preinitialization. * Add config parameter to _PyCoreConfig_SetString(). It now preinitializes Python. * _PyCoreConfig_SetPyArgv() now also preinitializes Python for wide argv * Fix _Py_PreInitializeFromCoreConfig(): don't pass args to _Py_PreInitializeFromPyArgv() if config.parse_argv=0. * Use "char * const *" and "wchar_t * const *" types for 'argv' parameters and _PyArgv.argv. * Add unit test on preinitialization from argv. * _PyPreConfig.allocator type becomes int * Add _PyPreConfig_InitFromPreConfig() and _PyPreConfig_InitFromCoreConfig() helper functions
* bpo-36763: Remove _PyCoreConfig.dll_path (GH-13402)Victor Stinner2019-05-181-3/+0
|
* bpo-36763: Use _PyCoreConfig_InitPythonConfig() (GH-13398)Victor Stinner2019-05-181-40/+65
| | | | | | | | | | | | | | | | | _PyPreConfig_InitPythonConfig() and _PyCoreConfig_InitPythonConfig() no longer inherit their values from global configuration variables. Changes: * _PyPreCmdline_Read() now ignores -X dev and PYTHONDEVMODE if dev_mode is already set. * Inline _PyPreConfig_INIT macro into _PyPreConfig_Init() function. * Inline _PyCoreConfig_INIT macro into _PyCoreConfig_Init() function. * Replace _PyCoreConfig_Init() with _PyCoreConfig_InitPythonConfig() in most tests of _testembed.c. * Replace _PyCoreConfig_Init() with _PyCoreConfig_InitIsolatedConfig() in _freeze_importlib.c. * Move some initialization functions from the internal to the private API.
* bpo-36945: Add _PyPreConfig.configure_locale (GH-13368)Victor Stinner2019-05-171-4/+30
| | | | | _PyPreConfig_InitIsolatedConfig() sets configure_locale to 0 to prevent Python to modify the LC_CTYPE locale. In that case, coerce_c_locale an coerce_c_locale_warn are set to 0 as well.
* bpo-36763: Add _PyCoreConfig_InitPythonConfig() (GH-13388)Victor Stinner2019-05-171-7/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* bpo-36763: Add PyMemAllocatorName (GH-13387)Victor Stinner2019-05-171-6/+9
| | | | | | | | | | | | | | * Add PyMemAllocatorName enum * _PyPreConfig.allocator type becomes PyMemAllocatorName, instead of char* * Remove _PyPreConfig_Clear() * Add _PyMem_GetAllocatorName() * Rename _PyMem_GetAllocatorsName() to _PyMem_GetCurrentAllocatorName() * Remove _PyPreConfig_SetAllocator(): just call _PyMem_SetupAllocators() directly, we don't have do reallocate the configuration with the new allocator anymore! * _PyPreConfig_Write() parameter becomes const, as it should be in the first place!
* bpo-36763: Remove _PyCoreConfig.program (GH-13373)Victor Stinner2019-05-171-5/+0
| | | Use _PyCoreConfig.program_name instead.
* bpo-36763: Add _PyCoreConfig.configure_c_stdio (GH-13363)Victor Stinner2019-05-161-0/+4
| | | Add tests for configure_c_stdio and pathconfig_warnings parameters.
* bpo-36763: Add _Py_InitializeMain() (GH-13362)Victor Stinner2019-05-161-12/+31
| | | | | | | | | * Add a private _Py_InitializeMain() function. * Add again _PyCoreConfig._init_main. * _Py_InitializeFromConfig() now uses _init_main to decide if _Py_InitializeMainInterpreter() should be called. * _PyCoreConfig: rename _frozen to pathconfig_warnings, its value is now the opposite of Py_FrozenFlag. * Add an unit test for _init_main=0 and _Py_InitializeMain().
* bpo-36763: Add _PyCoreConfig.parse_argv (GH-13361)Victor Stinner2019-05-161-0/+9
| | | | | | | * _PyCoreConfig_Read() doesn't parse nor update argv if parse_argv is 0. * Move path configuration fields in _PyCoreConfig. * Add an unit test for parse_argv=0. * Remove unused "done": label in _Py_RunMain().
* bpo-36763: InitConfigTests tests all core config (GH-13331)Victor Stinner2019-05-151-19/+26
| | | | | | | | | Remove UNTESTED_CORE_CONFIG from test_embed.InitConfigTests: all core config fields are now tested! Changes: * Test also dll_path on Windows * Add run_main_config unit test: test config using _Py_RunMain().
* bpo-36763: Add test for _PyCoreConfig_SetString() (GH-13275)Victor Stinner2019-05-141-7/+35
| | | | test_embed: add test_init_read_set() to test newly added APIs: test module_search_paths and executable.
* bpo-36763: Remove _PyCoreConfig._init_main (GH-13066)Victor Stinner2019-05-021-5/+8
|
* bpo-36763: Make _PyCoreConfig.check_hash_pycs_mode public (GH-13052)Victor Stinner2019-05-021-2/+2
| | | | | _PyCoreConfig: Rename _check_hash_pycs_mode field to check_hash_pycs_mode (make it public) and change its type from "const char*" to "wchar_t*".
* bpo-36471: Add _Py_RunMain() (GH-12618)Victor Stinner2019-03-291-2/+13
| | | | | * Add config_read_cmdline() subfunction. Remove _PyCmdline structure. * _PyCoreConfig_Read() now also parses config->argv command line arguments
* bpo-36443: Disable C locale coercion and UTF-8 Mode by default (GH-12589)Victor Stinner2019-03-271-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | bpo-36443, bpo-36202: Since Python 3.7.0, calling Py_DecodeLocale() before Py_Initialize() produces mojibake if the LC_CTYPE locale is coerced and/or if the UTF-8 Mode is enabled by the user configuration. This change fix the issue by disabling LC_CTYPE coercion and UTF-8 Mode by default. They must now be enabled explicitly (opt-in) using the new _Py_PreInitialize() API with _PyPreConfig. When embedding Python, set coerce_c_locale and utf8_mode attributes of _PyPreConfig to -1 to enable automatically these parameters depending on the LC_CTYPE locale, environment variables and command line arguments Alternative: Setting Py_UTF8Mode to 1 always explicitly enables the UTF-8 Mode. Changes: * _PyPreConfig_INIT now sets coerce_c_locale and utf8_mode to 0 by default. * _Py_InitializeFromArgs() and _Py_InitializeFromWideArgs() can now be called with config=NULL.
* bpo-36444: Add _PyCoreConfig._init_main (GH-12572)Victor Stinner2019-03-271-0/+1
| | | | | | | | * Add _PyCoreConfig._init_main: if equals to zero, _Py_InitializeFromConfig() doesn't call _Py_InitializeMainInterpreter(). * Add interp_p parameter to _Py_InitializeFromConfig(). * pymain_init() now calls _Py_InitializeFromConfig(). * Make _Py_InitializeCore() private.
* bpo-36444: Remove _PyMainInterpreterConfig (GH-12571)Victor Stinner2019-03-271-29/+0
|
* bpo-36301: Test Python init with isolated (GH-12569)Victor Stinner2019-03-261-0/+20
| | | Add test_preinit_isolated1() and test_preinit_isolated2() test_embed.
* bpo-36301: Cleanup preconfig.c and coreconfig.c (GH-12563)Victor Stinner2019-03-261-8/+9
| | | | | | | | | | | | | | | * _PyCoreConfig_Write() now updates _PyRuntime.preconfig * Remove _PyPreCmdline_Copy() * _PyPreCmdline_Read() now accepts _PyPreConfig and _PyCoreConfig optional configurations. * Rename _PyPreConfig_ReadFromArgv() to _PyPreConfig_Read(). Simplify the code. * Calling _PyCoreConfig_Read() no longer adds the warning options twice: don't add a warning option if it's already in the list. * Rename _PyCoreConfig_ReadFromArgv() to _PyCoreConfig_Read(). * Rename config_from_cmdline() to _PyCoreConfig_ReadFromArgv(). * Add more assertions on _PyCoreConfig in _PyCoreConfig_Read(). * Move some functions. * Make some config functions private.
* bpo-36301: Remove _PyCoreConfig.preconfig (GH-12546)Victor Stinner2019-03-261-17/+28
| | | | | | * Replace _PyCoreConfig.preconfig with 3 new fields in _PyCoreConfig: isolated, use_environment, dev_mode. * Add _PyPreCmdline.dev_mode. * Add _Py_PreInitializeFromPreConfigInPlace().
* bpo-36301: Add _Py_GetConfigsAsDict() function (GH-12540)Victor Stinner2019-03-251-38/+74
| | | | | | | * Add _Py_GetConfigsAsDict() function to get all configurations as a dict. * dump_config() of _testembed.c now dumps preconfig as a separated key: call _Py_GetConfigsAsDict(). * Make _PyMainInterpreterConfig_AsDict() private.
* bpo-36301: _PyCoreConfig_Read() ensures that argv is not empty (GH-12347)Victor Stinner2019-03-151-1/+1
| | | If argv is empty, add an empty string.
* bpo-36142: PYTHONMALLOC overrides PYTHONDEV (GH-12191)Victor Stinner2019-03-061-2/+8
| | | | | | | | bpo-34247, bpo-36142: The PYTHONMALLOC environment variable has the priority over PYTHONDEV env var and "-X dev" command line option. For example, PYTHONMALLOC=malloc PYTHONDEVMODE=1 sets the memory allocators to "malloc" (and not to "debug"). Add an unit test.
* bpo-36142: Add _PyPreConfig_SetAllocator() (GH-12187)Victor Stinner2019-03-061-3/+2
| | | | | | | | | | | * _PyPreConfig_Write() now reallocates the pre-configuration with the new memory allocator. * It is no longer needed to force the "default raw memory allocator" to clear pre-configuration and core configuration. Simplify the code. * _PyPreConfig_Write() now does nothing if called after Py_Initialize(): no longer check if the allocator is the same. * Remove _PyMem_GetDebugAllocatorsName(): dev mode sets again allocator to "debug".
* bpo-36142: Add _PyMem_GetDebugAllocatorsName() (GH-12185)Victor Stinner2019-03-051-2/+3
| | | | | The development mode now uses the effective name of the debug memory allocator ("pymalloc_debug" or "malloc_debug"). So the name doesn't change after setting the memory allocator.
* bpo-36142: Add _PyPreConfig.allocator (GH-12181)Victor Stinner2019-03-051-23/+29
| | | | | | * Move 'allocator' and 'dev_mode' fields from _PyCoreConfig to _PyPreConfig. * Fix InitConfigTests of test_embed: dev_mode sets allocator to "debug", add a new tests for env vars with dev mode enabled.
* bpo-36142: Remove _PyMain structure (GH-12120)Victor Stinner2019-03-011-0/+5
| | | | | | | | | | | | | * Move fields from _PyMain to _PyCoreConfig: * skip_first_line * run_command * run_module * run_filename * Replace _PyMain.stdin_is_interactive with a new stdin_is_interactive(config) function * Rename _PyMain to _PyArgv. Add "const _PyArgv *args" field to _PyCmdline.
* bpo-35313: Cleanup test_embed.py (GH-10716)Victor Stinner2018-11-261-4/+3
| | | | | * Remove an unused import. * Move get_expected_config() call to check_config() to ease backport to Python 3.7.
* bpo-35313: Fix test_embed when run from venv (GH-10713)Victor Stinner2018-11-261-63/+68
| | | | test_embed.InitConfigTests now gets the expected configuration from a child process run with -S to not run the site module.
* bpo-35239: _PySys_EndInit() copies module_search_path (GH-10532)Victor Stinner2018-11-161-8/+3
| | | | | | | | | | | * The _PySys_EndInit() function now copies the config->module_search_path list, so config is longer modified when sys.path is updated. * config->warnoptions list and config->xoptions dict are also copied * test_embed: InitConfigTests now also tests main_config['module_search_path'] * Fix _Py_InitializeMainInterpreter(): don't use config->warnoptions but sys.warnoptions to decide if the warnings module should be imported at startup.
* bpo-35233: InitConfigTests tests more config vars (GH-10541)Victor Stinner2018-11-141-84/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | test_embed.InitConfigTests tests more configuration variables. Changes: * InitConfigTests tests more core configuration variables: * base_exec_prefix * base_prefix * exec_prefix * home * legacy_windows_fs_encoding * legacy_windows_stdio * module_search_path_env * prefix * "_testembed init_from_config" tests more variables: * argv * warnoptions * xoptions * InitConfigTests: add check_global_config(), check_core_config() and check_main_config() subfunctions to cleanup the code. Move also constants at the class level (ex: COPY_MAIN_CONFIG). * Fix _PyCoreConfig_AsDict(): don't set stdio_encoding twice * Use more macros in _PyCoreConfig_AsDict() and _PyMainInterpreterConfig_AsDict() to reduce code duplication. * Other minor cleanups.