summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 2540f9d..2f71b97 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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();