Skip to content

Commit 8ddd09f

Browse files
committed
pythongh-123091: Use _Py_IsImmortalLoose() (python#123511)
Use _Py_IsImmortalLoose() in bytesobject.c, typeobject.c and ceval.c. (cherry picked from commit f1a0d96)
1 parent b76a4a5 commit 8ddd09f

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Objects/bytesobject.c

Lines changed: 3 additions & 3 deletions
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

Objects/typeobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ set_tp_bases(PyTypeObject *self, PyObject *bases, int initial)
452452
assert(PyTuple_GET_SIZE(bases) == 1);
453453
assert(PyTuple_GET_ITEM(bases, 0) == (PyObject *)self->tp_base);
454454
assert(self->tp_base->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
455-
assert(_Py_IsImmortal(self->tp_base));
455+
assert(_Py_IsImmortalLoose(self->tp_base));
456456
}
457457
_Py_SetImmortal(bases);
458458
}
@@ -469,7 +469,7 @@ clear_tp_bases(PyTypeObject *self, int final)
469469
Py_CLEAR(self->tp_bases);
470470
}
471471
else {
472-
assert(_Py_IsImmortal(self->tp_bases));
472+
assert(_Py_IsImmortalLoose(self->tp_bases));
473473
_Py_ClearImmortal(self->tp_bases);
474474
}
475475
}
@@ -534,7 +534,7 @@ clear_tp_mro(PyTypeObject *self, int final)
534534
Py_CLEAR(self->tp_mro);
535535
}
536536
else {
537-
assert(_Py_IsImmortal(self->tp_mro));
537+
assert(_Py_IsImmortalLoose(self->tp_mro));
538538
_Py_ClearImmortal(self->tp_mro);
539539
}
540540
}
@@ -5657,7 +5657,7 @@ fini_static_type(PyInterpreterState *interp, PyTypeObject *type,
56575657
int isbuiltin, int final)
56585658
{
56595659
assert(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
5660-
assert(_Py_IsImmortal((PyObject *)type));
5660+
assert(_Py_IsImmortalLoose((PyObject *)type));
56615661

56625662
type_dealloc_common(type);
56635663

Python/bytecodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ dummy_func(
362362
EXIT_IF(!PyLong_CheckExact(value));
363363
STAT_INC(TO_BOOL, hit);
364364
if (_PyLong_IsZero((PyLongObject *)value)) {
365-
assert(_Py_IsImmortal(value));
365+
assert(_Py_IsImmortalLoose(value));
366366
res = Py_False;
367367
}
368368
else {
@@ -389,7 +389,7 @@ dummy_func(
389389
EXIT_IF(!PyUnicode_CheckExact(value));
390390
STAT_INC(TO_BOOL, hit);
391391
if (value == &_Py_STR(empty)) {
392-
assert(_Py_IsImmortal(value));
392+
assert(_Py_IsImmortalLoose(value));
393393
res = Py_False;
394394
}
395395
else {

Python/executor_cases.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)