8000 fix recounting of immortal objects · python/cpython@cf62862 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf62862

Browse files
fix recounting of immortal objects
1 parent cfafd3a commit cf62862

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Modules/_io/textio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,7 @@ _textiowrapper_readline(textio *self, Py_ssize_t limit)
22392239
Py_CLEAR(chunks);
22402240
}
22412241
if (line == NULL) {
2242-
line = &_Py_STR(empty);
2242+
line = Py_NewRef(&_Py_STR(empty));
22432243
}
22442244

22452245
return line;

Objects/boolobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
static PyObject *
1010
bool_repr(PyObject *self)
1111
{
12-
return self == Py_True ? &_Py_ID(True) : &_Py_ID(False);
12+
PyObject *res = self == Py_True ? &_Py_ID(True) : &_Py_ID(False);
13+
return Py_NewRef(res);
1314
}
1415

1516
/* Function to return a bool from a C long */

0 commit comments

Comments
 (0)
0