-
Notifications
You must be signed in to change notification settings - Fork 124
Fix segmentation fault on Python 3.13 #960
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5328,6 +5328,10 @@ Struct_alloc(PyTypeObject *type) { | |
| PyObject *obj; | ||
| bool is_gc = MS_TYPE_IS_GC(type); | ||
|
|
||
| #if PY313_PLUS && !PY314_PLUS | ||
| type->tp_flags &= ~Py_TPFLAGS_INLINE_VALUES; | ||
| #endif | ||
|
|
||
| if (is_gc) { | ||
| obj = PyObject_GC_New(PyObject, type); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Manually calling I believe the root of this bug comes from the fact that on 3.13, inline values are initialized in the So, to fix this, just call |
||
| } | ||
|
|
||
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.
I'm almost certain you'll trigger assertion failures (or worse, get spurious crashes) with this. Supertypes don't expect their flags to be different in subtypes.