GH-103906: Remove immortal refcounting in the interpreter (GH-103909) · python/cpython@b4a9747 · GitHub
Skip to content

Commit b4a9747

Browse files
authored
GH-103906: Remove immortal refcounting in the interpreter (GH-103909)
1 parent 3a4c44b commit b4a9747

4 files changed

Lines changed: 476 additions & 516 deletions

File tree

Lines changed: 2 additions & 0 deletions

Objects/boolobject.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ bool_repr(PyObject *self)
2020

2121
PyObject *PyBool_FromLong(long ok)
2222
{
23-
PyObject *result;
24-
25-
if (ok)
26-
result = Py_True;
27-
else
28-
result = Py_False;
29-
return Py_NewRef(result);
23+
return ok ? Py_True : Py_False;
3024
}
3125

3226
/* We define bool_new to always return either Py_True or Py_False */

Python/bytecodes.c

Lines changed: 14 additions & 32 deletions

0 commit comments

Comments
 (0)