mirror of
https://github.com/python/cpython.git
synced 2025-07-18 16:55:20 +00:00
Issue #15781: Fix two small race conditions in import's module locking.
This commit is contained in:
parent
30147710e8
commit
0398985920
5 changed files with 3679 additions and 3655 deletions
|
@ -1408,7 +1408,11 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
|
|||
int initializing = 0;
|
||||
|
||||
Py_INCREF(mod);
|
||||
/* Only call _bootstrap._lock_unlock_module() if __initializing__ is true. */
|
||||
/* Optimization: only call _bootstrap._lock_unlock_module() if
|
||||
__initializing__ is true.
|
||||
NOTE: because of this, __initializing__ must be set *before*
|
||||
stuffing the new module in sys.modules.
|
||||
*/
|
||||
value = _PyObject_GetAttrId(mod, &PyId___initializing__);
|
||||
if (value == NULL)
|
||||
PyErr_Clear();
|
||||
|
|
7304
Python/importlib.h
7304
Python/importlib.h
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue