gh-121528: Fix _PyObject_Init() assertion for stable ABI
Add _Py_IsImmortalLoose() function for assertions.
- Issue: gh-121528
Well, I can confirm that rustworkx-0.15.1 passes all tests with this patch.
cc @colesbury @eduardo-elizondo
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. 🐍🍒⛏🤖
GH-121936 is a backport of this pull request to the 3.13 branch.
:warning::warning::warning: Buildbot failure :warning::warning::warning:
Hi! The buildbot s390x Fedora Clang 3.x has failed when building commit b826e459ca6b640f896c2a9551bb2c78d10f0e2b.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/#builders/3/builds/6425) and take a look at the build logs.
- Check if the failure is related to this commit (b826e459ca6b640f896c2a9551bb2c78d10f0e2b) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/#builders/3/builds/6425
Failed tests:
- test_pyrepl
Failed subtests:
- test_inspect_keeps_globals_from_inspected_module - test.test_pyrepl.test_pyrepl.TestMain.test_inspect_keeps_globals_from_inspected_module
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.clang/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __package__= not found in output
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.clang/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __file__= not found in output
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.clang/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: FOO= not found in output
Traceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-fedora-z.clang/build/Lib/test/test_pyrepl/test_pyrepl.py", line 995, in _run_repl_globals_test
self.fail(f"{var}= not found in output")
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: __name__= not found in output