mirror of
https://github.com/python/cpython.git
synced 2026-05-06 20:51:17 -04:00
gh-99578: Fix refleak in _imp.create_builtin() (GH-99642)
Fix a reference bug in _imp.create_builtin() after the creation of
the first sub-interpreter for modules "builtins" and "sys".
(cherry picked from commit cb2ef8b2ac)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
committed by
GitHub
parent
101dfaedb2
commit
37dbbb208f
+2
-1
@@ -1006,7 +1006,8 @@ create_builtin(PyThreadState *tstate, PyObject *name, PyObject *spec)
|
||||
if (_PyUnicode_EqualToASCIIString(name, p->name)) {
|
||||
if (p->initfunc == NULL) {
|
||||
/* Cannot re-init internal module ("sys" or "builtins") */
|
||||
return PyImport_AddModuleObject(name);
|
||||
mod = PyImport_AddModuleObject(name);
|
||||
return Py_XNewRef(mod);
|
||||
}
|
||||
|
||||
mod = (*p->initfunc)();
|
||||
|
||||
Reference in New Issue
Block a user