Skip to content

Commit ca6f0f9

Browse files
pablogsalYhg1s
andauthored
Update Python/import.c
Co-authored-by: T. Wouters <thomas@python.org>
1 parent dd2e38d commit ca6f0f9

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

Python/import.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3882,11 +3882,7 @@ _PyImport_LoadLazyImportTstate(PyThreadState *tstate, PyObject *lazy_import)
38823882
assert(lazy_import != NULL);
38833883
assert(PyLazyImport_CheckExact(lazy_import));
38843884

3885-
// Keep a strong reference to the lazy import object. During
3886-
// _PyImport_AcquireLock() below the GIL may be released, allowing
3887-
// another thread to resolve this same lazy import and drop all
3888-
// external references (from the globals dict and stack). The extra
3889-
// INCREF ensures the object stays alive while we work with it.
3885+
// lazy_import may be a borrowed ref. Keep it alive while we acquire the import lock.
38903886
Py_INCREF(lazy_import);
38913887

38923888
PyLazyImportObject *lz = (PyLazyImportObject *)lazy_import;

0 commit comments

Comments
 (0)