summaryrefslogtreecommitdiffstats
path: root/Parser/pegen.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-11-10 14:30:05 (GMT)
committerGitHub <noreply@github.com>2022-11-10 14:30:05 (GMT)
commit4ce2a202c7b573edaa0ee4a2315d5578f66737c5 (patch)
tree306b0a880ccfd96f3953d507fd7d23822c478462 /Parser/pegen.c
parent1e197e63e21f77b102ff2601a549dda4b6439455 (diff)
downloadcpython-4ce2a202c7b573edaa0ee4a2315d5578f66737c5.zip
cpython-4ce2a202c7b573edaa0ee4a2315d5578f66737c5.tar.gz
cpython-4ce2a202c7b573edaa0ee4a2315d5578f66737c5.tar.bz2
gh-99300: Use Py_NewRef() in Parser/ directory (#99330)
Replace Py_INCREF() with Py_NewRef() in C files of the Parser/ directory and in the PEG generator.
Diffstat (limited to 'Parser/pegen.c')
-rw-r--r--Parser/pegen.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Parser/pegen.c b/Parser/pegen.c
index 1317606..d34a86e 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -885,8 +885,7 @@ _PyPegen_run_parser_from_file_pointer(FILE *fp, int start_rule, PyObject *filena
tok->fp_interactive = 1;
}
// This transfers the ownership to the tokenizer
- tok->filename = filename_ob;
- Py_INCREF(filename_ob);
+ tok->filename = Py_NewRef(filename_ob);
// From here on we need to clean up even if there's an error
mod_ty result = NULL;
@@ -925,8 +924,7 @@ _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filen
return NULL;
}
// This transfers the ownership to the tokenizer
- tok->filename = filename_ob;
- Py_INCREF(filename_ob);
+ tok->filename = Py_NewRef(filename_ob);
// We need to clear up from here on
mod_ty result = NULL;