Skip to content

[3.13] gh-123091: Use _Py_IsImmortalLoose() (#123511) #123600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Objects/bytesobject.c
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ Py_LOCAL_INLINE(Py_ssize_t) _PyBytesWriter_GetSize(_PyBytesWriter *writer,
static inline PyObject* bytes_get_empty(void)
{
PyObject *empty = &EMPTY->ob_base.ob_base;
assert(_Py_IsImmortal(empty));
assert(_Py_IsImmortalLoose(empty));
return empty;
}

@@ -119,7 +119,7 @@ PyBytes_FromStringAndSize(const char *str, Py_ssize_t size)
}
if (size == 1 && str != NULL) {
op = CHARACTER(*str & 255);
assert(_Py_IsImmortal(op));
assert(_Py_IsImmortalLoose(op));
return (PyObject *)op;
}
if (size == 0) {
@@ -155,7 +155,7 @@ PyBytes_FromString(const char *str)
}
else if (size == 1) {
op = CHARACTER(*str & 255);
assert(_Py_IsImmortal(op));
assert(_Py_IsImmortalLoose(op));
return (PyObject *)op;
}

8 changes: 4 additions & 4 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
@@ -452,7 +452,7 @@ set_tp_bases(PyTypeObject *self, PyObject *bases, int initial)
assert(PyTuple_GET_SIZE(bases) == 1);
assert(PyTuple_GET_ITEM(bases, 0) == (PyObject *)self->tp_base);
assert(self->tp_base->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
assert(_Py_IsImmortal(self->tp_base));
assert(_Py_IsImmortalLoose(self->tp_base));
}
_Py_SetImmortal(bases);
}
@@ -469,7 +469,7 @@ clear_tp_bases(PyTypeObject *self, int final)
Py_CLEAR(self->tp_bases);
}
else {
assert(_Py_IsImmortal(self->tp_bases));
assert(_Py_IsImmortalLoose(self->tp_bases));
_Py_ClearImmortal(self->tp_bases);
}
}
@@ -534,7 +534,7 @@ clear_tp_mro(PyTypeObject *self, int final)
Py_CLEAR(self->tp_mro);
}
else {
assert(_Py_IsImmortal(self->tp_mro));
assert(_Py_IsImmortalLoose(self->tp_mro));
_Py_ClearImmortal(self->tp_mro);
}
}
@@ -5657,7 +5657,7 @@ fini_static_type(PyInterpreterState *interp, PyTypeObject *type,
int isbuiltin, int final)
{
assert(type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN);
assert(_Py_IsImmortal((PyObject *)type));
assert(_Py_IsImmortalLoose((PyObject *)type));

type_dealloc_common(type);

4 changes: 2 additions & 2 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
@@ -362,7 +362,7 @@ dummy_func(
EXIT_IF(!PyLong_CheckExact(value));
STAT_INC(TO_BOOL, hit);
if (_PyLong_IsZero((PyLongObject *)value)) {
assert(_Py_IsImmortal(value));
assert(_Py_IsImmortalLoose(value));
res = Py_False;
}
else {
@@ -389,7 +389,7 @@ dummy_func(
EXIT_IF(!PyUnicode_CheckExact(value));
STAT_INC(TO_BOOL, hit);
if (value == &_Py_STR(empty)) {
assert(_Py_IsImmortal(value));
assert(_Py_IsImmortalLoose(value));
res = Py_False;
}
else {
4 changes: 2 additions & 2 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.