summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2023-06-05 13:38:36 (GMT)
committerGitHub <noreply@github.com>2023-06-05 13:38:36 (GMT)
commit058b96053563bb5c413dc081eb8cc0916516525c (patch)
tree802cbc2b26ef0404f49eafb0f3de9f1800a3289d /Python/compile.c
parentcdfb201bfa35b7c50de5099c6d9078c806851d98 (diff)
downloadcpython-058b96053563bb5c413dc081eb8cc0916516525c.zip
cpython-058b96053563bb5c413dc081eb8cc0916516525c.tar.gz
cpython-058b96053563bb5c413dc081eb8cc0916516525c.tar.bz2
gh-103906: Remove immortal refcounting in compile/marshal.c (gh-103922)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index d52c2b0..3243172 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -900,10 +900,10 @@ static PyObject*
merge_consts_recursive(PyObject *const_cache, PyObject *o)
{
assert(PyDict_CheckExact(const_cache));
- // None and Ellipsis are singleton, and key is the singleton.
+ // None and Ellipsis are immortal objects, and key is the singleton.
// No need to merge object and key.
if (o == Py_None || o == Py_Ellipsis) {
- return Py_NewRef(o);
+ return o;
}
PyObject *key = _PyCode_ConstantKey(o);
@@ -6355,7 +6355,7 @@ compiler_error(struct compiler *c, location loc,
}
PyObject *loc_obj = PyErr_ProgramTextObject(c->c_filename, loc.lineno);
if (loc_obj == NULL) {
- loc_obj = Py_NewRef(Py_None);
+ loc_obj = Py_None;
}
PyObject *args = Py_BuildValue("O(OiiOii)", msg, c->c_filename,
loc.lineno, loc.col_offset + 1, loc_obj,