-
Notifications
You must be signed in to change notification settings - Fork 758
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
[py3.13] rustworkx: python: ./Include/internal/pycore_object.h:268: _PyObject_Init: Assertion '_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE) || _Py_IsImmortal(typeobj)' failed.
#4311
Comments
It looks to me like what's likely happened is a PyO3 extension using the 3.8 stable ABI has called Very similar situation to #4309 (comment), I think. The understanding there is that PyO3 is doing the correct thing. |
I'm a bit worried how many similar issues are we going to discover in 3.13… |
Interesting enough, this seems to happen on a code path specific to Python < 3.12. If I use |
That sounds correct. From Python 3.12 the stable ABI was switched to use a function call to do reference counting ( One option we have is to change our implementation of the stable ABI for older versions to also use the function call. This will come at a performance cost, but given that those projects will hit that performance cost anyway when they upgrade to minimum version of 3.12 we'd just be bringing that change forward. (That said, CPython is currently failing assertions against the older stable ABI so others in the C/C++ ecosystem will likely hit this too.) |
Given no reply from the committer I've CC-ed here, I'll file a bug report on the CPython bug tracker now. |
Filed python/cpython#121528. |
@davidhewitt, could you take a look at python/cpython#121528 (comment) and below, please? I'm not sure if it's because my reproducer isn't accurate, or PyO3 actually did something outside of specified stable ABI. |
Sure, commented on there. |
Looks like the upstream issue is resolved, so I will close here. |
Bug Description
Here's another problem that I've seen with a subset of
rustworkx
. This time I've confirmed that the issue happens both with a debug build made using Python 3.13 and a wheel built using Python 3.8 (i.e. the stable ABI).The error is:
Steps to Reproduce
--with-assertions
.git clone https://github.com/Qiskit/rustworkx/
rustworkx
andpytest
.python -m pytest tests/digraph/test_adjacency_matrix.py::TestDAGAdjacencyMatrix::test_graph_to_digraph_adjacency_matrix -s
Backtrace
Your operating system and version
Gentoo Linux amd64
Your Python version (
python --version
)3.13.0b3+ (with python/cpython#121358)
Your Rust version (
rustc --version
)rustc 1.79.0 (129f3b996 2024-06-10) (gentoo)
Your PyO3 version
0.21.2
How did you install python? Did you use a virtualenv?
Built from source, used a pure venv without system site-packages.
Additional Info
According to bisect, it's caused by python/cpython@c32dc47. CC-ing @markshannon, since I suspect this change actually broke the stable ABI (presuming PyO3 implemented it correctly).
The text was updated successfully, but these errors were encountered: