gh-102660: Fix Refleaks in import.c (#102744)

gh-102661 introduced some leaks. This fixes them.

https://github.com/python/cpython/issues/102660
This commit is contained in:
Eric Snow 2023-03-15 18:43:54 -06:00 committed by GitHub
parent 675b97a6ab
commit 2a03ed034e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 28 deletions

View file

@ -3425,9 +3425,6 @@ _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p)
return _PyStatus_ERR("failed to create a module object");
}
/* m_copy of Py_None means it is copied some other way. */
sysmodule.m_base.m_copy = Py_NewRef(Py_None);
PyObject *sysdict = PyModule_GetDict(sysmod);
if (sysdict == NULL) {
goto error;