https://github.com/python/cpython/commit/08f6b33bf32bdfc30eeda5966707849c459da7c2
commit: 08f6b33bf32bdfc30eeda5966707849c459da7c2
branch: main
author: Brandon <[email protected]>
committer: vstinner <[email protected]>
date: 2026-03-25T07:36:59+01:00
summary:
gh-146355: Fix `main_module` ref leak in `_PyRun_SimpleStringFlagsWithName`
(#146356)
files:
M Python/pythonrun.c
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index a21f494dc69d82..1e327848e656af 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -567,6 +567,7 @@ _PyRun_SimpleStringFlagsWithName(const char *command, const
char* name, PyCompil
PyObject* the_name = PyUnicode_FromString(name);
if (!the_name) {
PyErr_Print();
+ Py_DECREF(main_module);
return -1;
}
res = _PyRun_StringFlagsWithName(command, the_name, Py_file_input,
dict, dict, flags, 0);
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]