mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
bpo-39796: Fix _warnings module initialization (GH-18739)
* Add _PyWarnings_InitState() which only initializes the _warnings module state (tstate->interp->warnings) without creating a module object * Py_InitializeFromConfig() now calls _PyWarnings_InitState() instead of _PyWarnings_Init() * Rename also private functions of _warnings.c to avoid confusion between the public C API and the private C API.
This commit is contained in:
parent
4482337dec
commit
66b7973c1b
3 changed files with 29 additions and 15 deletions
|
@ -677,8 +677,9 @@ pycore_init_import_warnings(PyThreadState *tstate, PyObject *sysmod)
|
|||
const PyConfig *config = &tstate->interp->config;
|
||||
if (_Py_IsMainInterpreter(tstate)) {
|
||||
/* Initialize _warnings. */
|
||||
if (_PyWarnings_Init() == NULL) {
|
||||
return _PyStatus_ERR("can't initialize warnings");
|
||||
status = _PyWarnings_InitState(tstate);
|
||||
if (_PyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
if (config->_install_importlib) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue