Skip to content
Snippets Groups Projects
Unverified Commit 84d58ad1 authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by GitHub
Browse files

GH-90699: fix ref counting of static immortal strings (gh-94850)


(cherry picked from commit 1834133e)

Co-authored-by: default avatarKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
parent b3aec3ea
Branches
Tags
No related merge requests found
Fix reference counting bug in :meth:`bool.__repr__`. Patch by Kumar Aditya.
......@@ -2244,7 +2244,7 @@ _textiowrapper_readline(textio *self, Py_ssize_t limit)
Py_CLEAR(chunks);
}
if (line == NULL) {
line = &_Py_STR(empty);
line = Py_NewRef(&_Py_STR(empty));
}
return line;
......
......@@ -9,7 +9,8 @@
static PyObject *
bool_repr(PyObject *self)
{
return self == Py_True ? &_Py_ID(True) : &_Py_ID(False);
PyObject *res = self == Py_True ? &_Py_ID(True) : &_Py_ID(False);
return Py_NewRef(res);
}
/* Function to return a bool from a C long */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment