summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-06-22 22:04:39 (GMT)
committerGitHub <noreply@github.com>2023-06-22 22:04:39 (GMT)
commit193a2b2eaab9890f2cb16128c95bb63cb49307f1 (patch)
tree5adc9c1888c7338746c57c7b9ab329e8cf269795 /Python/pythonrun.c
parent403a574b000569ea2c91f5325e6a8061a29e64bf (diff)
downloadcpython-193a2b2eaab9890f2cb16128c95bb63cb49307f1.zip
cpython-193a2b2eaab9890f2cb16128c95bb63cb49307f1.tar.gz
cpython-193a2b2eaab9890f2cb16128c95bb63cb49307f1.tar.bz2
gh-105922: Use PyImport_AddModuleRef() function (#105999)
Replace PyImport_AddModuleObject() + Py_XNewRef() with PyImport_AddModuleRef() to get directly a strong reference.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index af82fa4..2986622 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -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;