summaryrefslogtreecommitdiffstats
path: root/Include/cpython
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41986: Add Py_FileSystemDefaultEncodeErrors and Py_UTF8Mode back to ↵Miss Skeleton (bot)2020-10-101-8/+0
| | | | | | | limited API (GH-22621) (cherry picked from commit 637a09b0d6e3ad4e34e0b5e0fc82f5afeae6f74b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41098: Doc: Add missing deprecated directives (GH-21162)Miss Islington (bot)2020-08-071-2/+8
| | | | | | | PyUnicodeEncodeError_Create has been deprecated with `Py_DEPRECATED` macro. But it was not documented. (cherry picked from commit 46e19b61d31ba99f049258efa4ff1334856a3643) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-20526: Fix PyThreadState_Clear(): don't decref frame (GH-19120) (GH-19136)Victor Stinner2020-03-241-0/+1
| | | | | | | | | | PyThreadState.frame is a borrowed reference, not a strong reference: PyThreadState_Clear() must not call Py_CLEAR(tstate->frame). Remove test_threading.test_warnings_at_exit(): we cannot warranty that the Python thread state of daemon threads is cleared in a reliable way during Python shutdown. (cherry picked from commit 5804f878e779712e803be927ca8a6df389d82cdf)
* bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623)Victor Stinner2019-10-071-0/+4
| | | Always define _PyUnicode_CheckConsistency() in the CPython C API.
* bpo-38304: PyConfig_InitPythonConfig() cannot fail anymore (GH-16509)Miss Islington (bot)2019-10-011-2/+2
| | | | | | | PyConfig_InitPythonConfig() and PyConfig_InitIsolatedConfig() no longer return PyStatus: they cannot fail anymore. (cherry picked from commit 8462a4936b3a551dc546a6adea04a70b0a07ca67) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-38304: Remove PyConfig.struct_size (GH-16500)Victor Stinner2019-09-301-10/+2
| | | | | For now, we'll rely on the fact that the config structures aren't covered by the stable ABI. We may revisit this in the future if we further explore the idea of offering a stable embedding API.
* bpo-38317: Fix PyConfig.warnoptions priority (GH-16478)Miss Islington (bot)2019-09-291-1/+4
| | | | | | | | | | | | 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>
* bpo-38304: Add PyConfig.struct_size (GH-16451) (GH-16453)Victor Stinner2019-09-281-7/+10
| | | | | | | | | | | | | | | | | | | Add a new struct_size field to PyPreConfig and PyConfig structures to allow to modify these structures in the future without breaking the backward compatibility. * Replace private _config_version field with public struct_size field in PyPreConfig and PyConfig. * Public PyPreConfig_InitIsolatedConfig() and PyPreConfig_InitPythonConfig() return type becomes PyStatus, instead of void. * Internal _PyConfig_InitCompatConfig(), _PyPreConfig_InitCompatConfig(), _PyPreConfig_InitFromConfig(), _PyPreConfig_InitFromPreConfig() return type becomes PyStatus, instead of void. * Remove _Py_CONFIG_VERSION * Update the Initialization Configuration documentation. (cherry picked from commit 441b10cf2855955c86565f8d59e72c2efc0f0a57)
* [3.8] bpo-38005: Fixed comparing and creating of InterpreterID and ↵Serhiy Storchaka2019-09-141-2/+0
| | | | | | | | | | | | | | ChannelID. (GH-15652) (GH-16145) * Fix a crash in comparing with float (and maybe other crashes). * They are now never equal to strings and non-integer numbers. * Comparison with a large number no longer raises OverflowError. * Arbitrary exceptions no longer silenced in constructors and comparisons. * TypeError raised in the constructor contains now the name of the type. * Accept only ChannelID and int-like objects in channel functions. * Accept only InterpreterId, int-like objects and str in the InterpreterId constructor. * Accept int-like objects, not just int in interpreter related functions. (cherry picked from commit bf169915ecdd42329726104278eb723a7dda2736)
* bpo-36763: Implement PyWideStringList_Insert() of PEP 587 (GH-15423)Miss Islington (bot)2019-08-231-0/+3
| | | | | (cherry picked from commit 3842f2997fbd4dc840986aad2bb94656815e243b) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-36763: Add PyConfig_SetWideStringList() (GH-14444)Miss Islington (bot)2019-07-011-0/+3
| | | | | (cherry picked from commit 36242fd871d0f0977e720d4fae5700774bd8c09a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-37369: Fix initialization of sys members when launched via an app ↵Steve Dower2019-06-291-4/+5
| | | | | | 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
* [3.8] bpo-37250: put back tp_print for backwards compatibility (GH-14193)Jeroen Demeyer2019-06-251-0/+3
| | | | | | This is a 3.8-only compatibility measure for third-party Cython-based sdists. https://bugs.python.org/issue37250
* bpo-37191: Avoid declaration-after-statement in header included from ↵Petr Viktorin2019-06-071-4/+7
| | | | Python.h (GH-13887)
* Revert "bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)" (GH-13795)Victor Stinner2019-06-041-3/+3
| | | This reverts commit 396e0a8d9dc65453cb9d53500d0a620602656cfe.
* bpo-36818: Add PyInterpreterState.runtime field. (gh-13129)Eric Snow2019-06-011-3/+3
| | | https://bugs.python.org/issue36818
* bpo-36974: remove _PyObject_HasFastCall (GH-13460)Jeroen Demeyer2019-05-301-4/+0
|
* bpo-36974: implement PEP 590 (GH-13185)Jeroen Demeyer2019-05-292-41/+91
| | | | | Co-authored-by: Jeroen Demeyer <J.Demeyer@UGent.be> Co-authored-by: Mark Shannon <mark@hotpy.org>
* Fix comments in initconfig.h (GH-13636)MandarJKulkarni2019-05-281-3/+3
|
* bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)Zackery Spytz2019-05-282-71/+74
|
* bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) ↵Matthias Bussonnier2019-05-281-3/+0
| | | | | | | | | | (GH-13577) It has been documented as deprecated and to be removed in 3.8; From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`. https://bugs.python.org/issue36933
* bpo-36763: Implement the PEP 587 (GH-13592)Victor Stinner2019-05-273-91/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-36829: Add _PyErr_WriteUnraisableMsg() (GH-13488)Victor Stinner2019-05-271-0/+3
| | | | | * sys.unraisablehook: add 'err_msg' field to UnraisableHookArgs. * Use _PyErr_WriteUnraisableMsg() in _ctypes _DictRemover_call() and gc delete_garbage().
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-232-0/+53
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36763: Add _PyPreConfig._config_init (GH-13481)Victor Stinner2019-05-221-11/+11
| | | | | | | | | | | | | | | | | | | * _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 _PyRuntime.preconfig.coerce_c_locale (GH-13444)Victor Stinner2019-05-201-2/+2
| | | | | | | | | | | _PyRuntime.preconfig.coerce_c_locale can now be used to check if the C locale has been coerced. * Fix _Py_LegacyLocaleDetected(): don't attempt to coerce the C locale if LC_ALL environment variable is set. Add 'warn' parameter: emit_stderr_warning_for_legacy_locale() must not the LC_ALL env var. * _PyPreConfig_Write() sets coerce_c_locale to 0 if _Py_CoerceLegacyLocale() fails.
* bpo-36763: Fix Python preinitialization (GH-13432)Victor Stinner2019-05-202-6/+20
| | | | | | | | | | | | | | | | | | | | | * 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-35134: Split traceback.h header (GH-13430)Victor Stinner2019-05-191-0/+22
| | | | Add new Include/cpython/traceback.h and Include/internal/traceback.h header files.
* 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-60/+17
| | | | | | | | | | | | | | | | | _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-36763: _Py_InitializeFromArgs() argc becomes Py_ssize_t (GH-13396)Victor Stinner2019-05-171-4/+4
| | | | | | | * The type of initlization function 'argc' parameters becomes Py_ssize_t, instead of int. * Change _PyPreConfig_Copy() return type to void, instead of int. The function cannot fail anymore. * Fix compilation warnings on Windows.
* bpo-36763: Add _PyInitError functions (GH-13395)Victor Stinner2019-05-171-30/+7
| | | | | | | | | | | | | | | * Add _PyInitError functions: * _PyInitError_Ok() * _PyInitError_Error() * _PyInitError_NoMemory() * _PyInitError_Exit() * _PyInitError_IsError() * _PyInitError_IsExit() * _PyInitError_Failed() * frozenmain.c and _testembed.c now use functions rather than macros. * Move _Py_INIT_xxx() macros to the internal API. * Move _PyWstrList_INIT macro to the internal API.
* bpo-36945: Add _PyPreConfig.configure_locale (GH-13368)Victor Stinner2019-05-171-0/+5
| | | | | _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/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-172-7/+18
| | | | | | | | | | | | | | * 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/+9
| | | Use _PyCoreConfig.program_name instead.
* bpo-36763: Add _PyCoreConfig.configure_c_stdio (GH-13363)Victor Stinner2019-05-161-0/+9
| | | Add tests for configure_c_stdio and pathconfig_warnings parameters.
* bpo-36763: Add _Py_InitializeMain() (GH-13362)Victor Stinner2019-05-162-4/+10
| | | | | | | | | * 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-22/+39
| | | | | | | * _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: _PyInitError always use int for exitcode (GH-13360)Victor Stinner2019-05-161-4/+0
| | | | | | | | | | | | | | | | | We cannot use "unsigned int" for exitcode on Windows, since Py_Main() and _Py_RunMain() always return an "int". Changes: * _PyPathConfig_ComputeSysPath0() now returns -1 if an exception is raised. * pymain_run_python() no longer uses _PyInitError but display the exception and set exitcode to 1 in case of error. * Fix _Py_RunMain(): return an exitcode rather than calling exit() on pymain_run_python() failure. * _Py_ExitInitError() no longer uses ExitProcess() on Windows, use exit() on all platforms. * _Py_ExitInitError() now fails with a fatal error if 'err' is not an error not an exit.
* bpo-36763: Remove _PyCoreConfig._init_main (GH-13066)Victor Stinner2019-05-021-5/+1
|
* bpo-36775: _PyCoreConfig only uses wchar_t* (GH-13062)Victor Stinner2019-05-021-4/+4
| | | | | | | | | | | | | | | | | _PyCoreConfig: Change filesystem_encoding, filesystem_errors, stdio_encoding and stdio_errors fields type from char* to wchar_t*. Changes: * PyInterpreterState: replace fscodec_initialized (int) with fs_codec structure. * Add get_error_handler_wide() and unicode_encode_utf8() helper functions. * Add error_handler parameter to unicode_encode_locale() and unicode_decode_locale(). * Remove _PyCoreConfig_SetString(). * Rename _PyCoreConfig_SetWideString() to _PyCoreConfig_SetString(). * Rename _PyCoreConfig_SetWideStringFromString() to _PyCoreConfig_DecodeLocale().
* bpo-36763: Add _PyCoreConfig._config_version (GH-13065)Victor Stinner2019-05-021-3/+13
| | | | Add private _config_version field to _PyPreConfig and _PyCoreConfig to prepare future ABI compatibility.
* bpo-36763: Make _PyCoreConfig.check_hash_pycs_mode public (GH-13052)Victor Stinner2019-05-021-4/+3
| | | | | _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-36763: Rework _PyInitError API (GH-13031)Victor Stinner2019-05-011-15/+28
| | | | | | | | | * Remove _PyInitError.user_err field and _Py_INIT_USER_ERR() macro: use _Py_INIT_ERR() instead. _Py_ExitInitError() now longer calls abort() on error: exit with exit code 1 instead. * Add _PyInitError._type private field. * exitcode field type is now unsigned int on Windows. * Rename prefix field to _func. * Rename msg field to err_msg.
* bpo-36356: pymain_exit_error() only call pymain_free() for exit (GH-12968)Victor Stinner2019-04-261-1/+3
| | | Add _Py_INIT_HAS_EXITCODE() macro.
* bpo-36710: PyOS_AfterFork_Child() pass runtime parameter (GH-12936)Victor Stinner2019-04-241-1/+0
| | | | | | | | | The PyOS_AfterFork_Child() function now pass a 'runtime' parameter to subfunctions. * Fix _PyRuntimeState_ReInitThreads(): use the correct memory allocator * Add runtime parameter to _PyRuntimeState_ReInitThreads(), _PyGILState_Reinit() and _PyInterpreterState_DeleteExceptMain() * Move _PyGILState_Reinit() to the internal C API.
* bpo-36710: Add runtime parameter to _PyThreadState_Init() (GH-12935)Victor Stinner2019-04-241-2/+0
| | | | | | * Add 'runtime' parameter to _PyThreadState_Init() * Add 'gilstate' parameter to _PyGILState_NoteThreadState() * Move _PyThreadState_Init() and _PyThreadState_DeleteExcept() to the internal C API.
* bpo-36635: Add _testinternalcapi module (GH-12841)Victor Stinner2019-04-181-5/+0
| | | | | | Add a new _testinternalcapi module to test the internal C API. Move _Py_GetConfigsAsDict() function to the internal C API: _testembed now uses _testinternalcapi to access the function.
* bpo-35134: Add Include/cpython/pymem.h (GH-12840)Victor Stinner2019-04-151-0/+99
| | | | Move unstable CPython API from Include/pymem.h into a new Include/cpython/pymem.h header file.