Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jun 5, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,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 object, and key is the singleton.
corona10 marked this conversation as resolved.
Show resolved Hide resolved
// 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);
Expand Down Expand Up @@ -5706,7 +5706,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,
Expand Down