Open
Conversation
a153226 to
8caa953
Compare
Contributor
Author
|
@vstinner could you please review this? |
Python 3.13 changed how type __dict__ is handled for heap types. When using PyType_FromSpec, the Py_TPFLAGS_MANAGED_DICT flag is NOT automatically inherited from object - it must be set explicitly. Without this flag, creating instances of HPy types would crash in PyObject_GC_New() because the GC system expects managed dict support. Changes: - ctx_type.c: Explicitly set Py_TPFLAGS_MANAGED_DICT | Py_TPFLAGS_HAVE_GC in create_slot_defs() on Python 3.13+ - autogen_hpyfunc_trampolines.h: Fix NOARGS trampoline to include required second parameter per CPython C API docs (METH_NOARGS requires 2 params)
vstinner
reviewed
Jan 14, 2026
Contributor
vstinner
left a comment
There was a problem hiding this comment.
The overall change LGTM, but I'm not a HPy developer so I cannot properly review the change.
Contributor
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HPy-defined types crashed with a segmentation fault on Python 3.13 when creating or instantiating types using the Universal ABI.