gh-103906: Remove immortal refcounting in compile/marshal.c (gh-103922)

This commit is contained in:
Dong-hee Na 2023-06-05 22:38:36 +09:00 committed by GitHub
parent cdfb201bfa
commit 058b960535
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View file

@ -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,