-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[BUG]: make_static_property_type() is incompatible with Python 3.13 ands leads to a crash #4970
Comments
The issue is quite tricky. Context: |
I wrote #4971 to fix the issue. |
By the way, the following code in extern "C" inline int pybind11_traverse(PyObject *self, visitproc visit, void *arg) {
PyObject *&dict = *_PyObject_GetDictPtr(self);
Py_VISIT(dict); And the following code can be updated to use: PyObject_ClearManagedDict() (new in Python 3.13) extern "C" inline int pybind11_clear(PyObject *self) {
PyObject *&dict = *_PyObject_GetDictPtr(self);
Py_CLEAR(dict); |
Is there a chance that you could send a PR with that change? |
I created #4973 to use PyObject_VisitManagedDict() and PyObject_ClearManagedDict(). |
Closed by #4973 |
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.11.1
Problem description
Running python-contourpy tests on Python 3.13 does crash. Using a Python debug build, the following assertion fails:
The problem is the
pybind11_static_property
type created as a Python heap type inmake_static_property_type()
ofpybind11/include/pybind11/detail/class.h
which sets thePy_TPFLAGS_MANAGED_DICT
flag after callingPyType_Ready()
. Maybe it worked on Python 3.12, but it no longer works on Python 3.13 which requires the flag to be set before callingPyType_Ready()
.Fedora downstream issue about the contourpy crash: https://bugzilla.redhat.com/show_bug.cgi?id=2252083
Note: I tested the Fedora package python3-pybind11-2.11.1-1.fc40.x86_64.
Reproducible example code
Is this a regression? Put the last known working version here if it is.
Work on Python 3.12, crash on Python 3.13
The text was updated successfully, but these errors were encountered: