Skip to content

Commit f1a0d96

Browse files
authored
gh-123091: Use _Py_IsImmortalLoose() (#123511)
Use _Py_IsImmortalLoose() in bytesobject.c, typeobject.c and ceval.c.
1 parent 22fdb8c commit f1a0d96

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

Diff for: Include/internal/pycore_opcode_metadata.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Include/internal/pycore_uop_metadata.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Objects/bytesobject.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Py_LOCAL_INLINE(Py_ssize_t) _PyBytesWriter_GetSize(_PyBytesWriter *writer,
4646
static inline PyObject* bytes_get_empty(void)
4747
{
4848
PyObject *empty = &EMPTY->ob_base.ob_base;
49-
assert(_Py_IsImmortal(empty));
49+
assert(_Py_IsImmortalLoose(empty));
5050
return empty;
5151
}
5252

@@ -119,7 +119,7 @@ PyBytes_FromStringAndSize(const char *str, Py_ssize_t size)
119119
}
120120
if (size == 1 && str != NULL) {
121121
op = CHARACTER(*str & 255);
122-
assert(_Py_IsImmortal(op));
122+
assert(_Py_IsImmortalLoose(op));
123123
return (PyObject *)op;
124124
}
125125
if (size == 0) {
@@ -155,7 +155,7 @@ PyBytes_FromString(const char *str)
155155
}
156156
else if (size == 1) {
157157
op = CHARACTER(*str & 255);
158-
assert(_Py_IsImmortal(op));
158+
assert(_Py_IsImmortalLoose(op));
159159
return (PyObject *)op;
160160
}
161161

Diff for: Objects/typeobject.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ set_tp_bases(PyTypeObject *self, PyObject *bases, int initial)
485485
assert(PyTuple_GET_SIZE(bases) == 1);
486486
assert(PyTuple_GET_ITEM(bases, 0) == (PyObject *)self->tp_base);
487487
assert(self->tp_base->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
488-
assert(_Py_IsImmortal(self->tp_base));
488+
assert(_Py_IsImmortalLoose(self->tp_base));
489489
}
490490
_Py_SetImmortal(bases);
491491
}
@@ -502,7 +502,7 @@ clear_tp_bases(PyTypeObject *self, int final)
502502
Py_CLEAR(self->tp_bases);
503503
}
504504
else {
505-
assert(_Py_IsImmortal(self->tp_bases));
505+
assert(_Py_IsImmortalLoose(self->tp_bases));
506506
_Py_ClearImmortal(self->tp_bases);
507507
}
508508
}
@@ -567,7 +567,7 @@ clear_tp_mro(PyTypeObject *self, int final)
567567
Py_CLEAR(self->tp_mro);
568568
}
569569
else {
570-
assert(_Py_IsImmortal(self->tp_mro));
570+
assert(_Py_IsImmortalLoose(self->tp_mro));
571571
_Py_ClearImmortal(self->tp_mro);
572572
}
573573
}
@@ -5869,7 +5869,7 @@ fini_static_type(PyInterpreterState *interp, PyTypeObject *type,
58695869
int isbuiltin, int final)
58705870
{
58715871
assert(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
5872-
assert(_Py_IsImmortal((PyObject *)type));
5872+
assert(_Py_IsImmortalLoose((PyObject *)type));
58735873

58745874
type_dealloc_common(type);
58755875

Diff for: Python/bytecodes.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ dummy_func(
374374
EXIT_IF(!PyLong_CheckExact(value_o));
375375
STAT_INC(TO_BOOL, hit);
376376
if (_PyLong_IsZero((PyLongObject *)value_o)) {
377-
assert(_Py_IsImmortal(value_o));
377+
assert(_Py_IsImmortalLoose(value_o));
378378
res = PyStackRef_False;
379379
}
380380
else {
@@ -403,7 +403,7 @@ dummy_func(
403403
EXIT_IF(!PyUnicode_CheckExact(value_o));
404404
STAT_INC(TO_BOOL, hit);
405405
if (value_o == &_Py_STR(empty)) {
406-
assert(_Py_IsImmortal(value_o));
406+
assert(_Py_IsImmortalLoose(value_o));
407407
res = PyStackRef_False;
408408
}
409409
else {

Diff for: Python/executor_cases.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Python/generated_cases.c.h

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)