mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
gh-99578: Fix refleak in _imp.create_builtin() (#99642)
Fix a reference bug in _imp.create_builtin() after the creation of the first sub-interpreter for modules "builtins" and "sys".
This commit is contained in:
parent
1cae31d26b
commit
cb2ef8b2ac
3 changed files with 35 additions and 1 deletions
|
@ -1035,7 +1035,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 = _PyImport_InitFunc_TrampolineCall(*p->initfunc);
|
||||
if (mod == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue