https://github.com/python/cpython/commit/4f87c99a5ae9c74a5f94b91335d85f4662e1ed48
commit: 4f87c99a5ae9c74a5f94b91335d85f4662e1ed48
branch: main
author: Pieter Eendebak <[email protected]>
committer: encukou <[email protected]>
date: 2026-03-11T14:24:15+01:00
summary:

gh-145376: Fix refleak & pointer type bug in uncommon code paths in Parser/ 
(GH-145684)

files:
M Parser/pegen.c

diff --git a/Parser/pegen.c b/Parser/pegen.c
index 7ecc55eee13775..569f5afb312008 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -924,7 +924,6 @@ _PyPegen_set_syntax_error_metadata(Parser *p) {
         the_source // N gives ownership to metadata
     );
     if (!metadata) {
-        Py_DECREF(the_source);
         PyErr_Clear();
         return;
     }
@@ -1026,8 +1025,8 @@ _PyPegen_run_parser_from_file_pointer(FILE *fp, int 
start_rule, PyObject *filena
 
     if (tok->fp_interactive && tok->interactive_src_start && result && 
interactive_src != NULL) {
         *interactive_src = PyUnicode_FromString(tok->interactive_src_start);
-        if (!interactive_src || _PyArena_AddPyObject(arena, *interactive_src) 
< 0) {
-            Py_XDECREF(interactive_src);
+        if (!*interactive_src || _PyArena_AddPyObject(arena, *interactive_src) 
< 0) {
+            Py_XDECREF(*interactive_src);
             result = NULL;
             goto error;
         }

_______________________________________________
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]

Reply via email to