mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-105922: Use PyImport_AddModuleRef() function (#105999)
Replace PyImport_AddModuleObject() + Py_XNewRef() with PyImport_AddModuleRef() to get directly a strong reference.
This commit is contained in:
parent
403a574b00
commit
193a2b2eaa
2 changed files with 2 additions and 3 deletions
|
@ -276,7 +276,7 @@ PyRun_InteractiveOneObjectEx(FILE *fp, PyObject *filename,
|
|||
return parse_res;
|
||||
}
|
||||
|
||||
PyObject *main_module = Py_XNewRef(PyImport_AddModuleObject(&_Py_ID(__main__)));
|
||||
PyObject *main_module = PyImport_AddModuleRef("__main__");
|
||||
if (main_module == NULL) {
|
||||
_PyArena_Free(arena);
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue