summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-10-20 20:31:26 (GMT)
committerGitHub <noreply@github.com>2023-10-20 20:31:26 (GMT)
commit124259f9b30f6cbab4dd2bcfb0d32f1cddcc35db (patch)
tree39b669ac077b565790ce9e26fe39268fcb842e91 /Python
parent37e4e20eaa8f27ada926d49e5971fecf0477ad26 (diff)
downloadcpython-124259f9b30f6cbab4dd2bcfb0d32f1cddcc35db.zip
cpython-124259f9b30f6cbab4dd2bcfb0d32f1cddcc35db.tar.gz
cpython-124259f9b30f6cbab4dd2bcfb0d32f1cddcc35db.tar.bz2
gh-111132: Fix crash on interactive_filename in `run_mod` (#111136)
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index b915c06..db49916 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1277,7 +1277,9 @@ run_mod(mod_ty mod, PyObject *filename, PyObject *globals, PyObject *locals,
PyCodeObject *co = _PyAST_Compile(mod, interactive_filename, flags, -1, arena);
if (co == NULL) {
- Py_DECREF(interactive_filename);
+ if (interactive_src) {
+ Py_DECREF(interactive_filename);
+ }
return NULL;
}