Fix PyArray_DTypeMeta definition when Py_LIMITED_API is disabled#532
Open
mattiapenati wants to merge 1 commit intoPyO3:mainfrom
Open
Fix PyArray_DTypeMeta definition when Py_LIMITED_API is disabled#532mattiapenati wants to merge 1 commit intoPyO3:mainfrom
mattiapenati wants to merge 1 commit intoPyO3:mainfrom
Conversation
Icxolu
reviewed
Feb 16, 2026
Contributor
Icxolu
left a comment
There was a problem hiding this comment.
Thank you, looks like this is a npyffi fix only and was not used within our abstraction layer itself as far as I can see.
I think we are still missing a field in the struct. Also could you please add a changelog entry for this fix.
Comment on lines
557
to
558
| pub singleton: *mut PyArray_Descr, | ||
| pub scalar_type: *mut PyTypeObject, |
Contributor
There was a problem hiding this comment.
I think the type_num field is missing here, right?
Contributor
Author
There was a problem hiding this comment.
Thanks so much! I completely missed that field.
4633ef9 to
52ff7fe
Compare
Contributor
Author
|
I updated the changelog and wrote "unreleased" because I'm not sure what version number to use. |
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.
When
Py_LIMITED_APIis disabled,PyArray_DTypeMetahas a different memory layout thanPyTypeObject. This is explicitly documented in the NumPy C-API reference, which states thatPyArray_DTypeMetacontains additional fields beyond those inPyTypeObject.This structure is confirmed by the header file definition.