-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
gh-123091: Use more _Py_IsImmortalLoose() #123602
Conversation
Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...) The remaining calls to _Py_IsImmortal are in free-threaded-only code, initialization of core objects, tests, and guards that fall back to code that works with mortal objects.
Remaining calls: $ git grep 'assert.*Py_IsImmortal'|grep -v Loose
Include/internal/pycore_stackref.h: assert(_Py_IsImmortal(obj));
Modules/_testcapi/immortal.c: assert(_Py_IsImmortal(object));
Objects/codeobject.c: assert(_Py_IsImmortal(entry->value));
Objects/object.c: assert(!_Py_IsImmortal(op));
Objects/object.c: assert(_Py_IsImmortal(constants[i]));
Objects/structseq.c: assert(_Py_IsImmortal(type));
Objects/typeobject.c: assert(_Py_IsImmortal((PyObject *)self));
Objects/unicodeobject.c: assert(!_Py_IsImmortal(s));
Programs/_testembed.c: assert(_Py_IsImmortal(str1));
Python/crossinterp.c: assert(_Py_IsImmortal((PyObject *)type));
Python/crossinterp.c: assert(_Py_IsImmortal((PyObject *)info->builtin));
Python/optimizer_symbols.c: assert(_Py_IsImmortal(val_42));
Python/optimizer_symbols.c: assert(_Py_IsImmortal(val_43)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. IMO it should be backported to 3.13.
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @encukou, I could not cleanly backport this to
|
Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...) The remaining calls to _Py_IsImmortal are in free-threaded-only code, initialization of core objects, tests, and guards that fall back to code that works with mortal objects. (cherry picked from commit 57c471a)
GH-123622 is a backport of this pull request to the 3.13 branch. |
Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...) The remaining calls to _Py_IsImmortal are in free-threaded-only code, initialization of core objects, tests, and guards that fall back to code that works with mortal objects. (cherry picked from commit 57c471a)
Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...) The remaining calls to _Py_IsImmortal are in free-threaded-only code, initialization of core objects, tests, and guards that fall back to code that works with mortal objects. (For this 3.12 backport commit, I re-checked all calls to _Py_IsImmortal; the changed calls are different from the commits to 3.13 & 3.14.)
Switch more _Py_IsImmortal(...) assertions to _Py_IsImmortalLoose(...), to account for stable-ABI extensions changing the refcount of immortal objects (similar to the
_Py_IMMORTAL_BIT
/_Py_IMMORTAL_REFCNT
design that was approved in PEP-683 but never implemented).The remaining calls to _Py_IsImmortal are in free-threaded-only code, initialization of core objects, tests, and guards that fall back to code that works with mortal objects.
Objects/bytesobject.c:122: PyBytes_FromStringAndSize: Assertion '_Py_IsImmortal(op)' failed.
#123091