mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
GH-90699: fix ref counting of static immortal strings (gh-94850)
(cherry picked from commit 1834133e66
)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
parent
b3aec3ea58
commit
84d58ad17b
3 changed files with 4 additions and 2 deletions
|
@ -0,0 +1 @@
|
||||||
|
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);
|
Py_CLEAR(chunks);
|
||||||
}
|
}
|
||||||
if (line == NULL) {
|
if (line == NULL) {
|
||||||
line = &_Py_STR(empty);
|
line = Py_NewRef(&_Py_STR(empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
static PyObject *
|
static PyObject *
|
||||||
bool_repr(PyObject *self)
|
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 */
|
/* Function to return a bool from a C long */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue