FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-103906: Remove immortal refcounting in compile/marshal.c by corona10 · Pull Request #103922 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion Objects/sliceobject.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ellipsis_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
PyErr_SetString(PyExc_TypeError, "EllipsisType takes no arguments");
return NULL;
}
return Py_NewRef(Py_Ellipsis);
return Py_Ellipsis;
}

static void
Expand Down
6 changes: 3 additions & 3 deletions Python/compile.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 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);
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
8 changes: 4 additions & 4 deletions Python/marshal.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1015,23 +1015,23 @@ r_object(RFILE *p)
break;

case TYPE_NONE:
retval = Py_NewRef(Py_None);
retval = Py_None;
break;

case TYPE_STOPITER:
retval = Py_NewRef(PyExc_StopIteration);
break;

case TYPE_ELLIPSIS:
retval = Py_NewRef(Py_Ellipsis);
retval = Py_Ellipsis;
break;

case TYPE_FALSE:
retval = Py_NewRef(Py_False);
retval = Py_False;
break;

case TYPE_TRUE:
retval = Py_NewRef(Py_True);
retval = Py_True;
break;

case TYPE_INT:
Expand Down

Back | FazBrowse Home | New Git URL