-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
API: Create Preliminary DTypeMeta class and np.dtype subclasses #15508
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1809a0f
API: Create Preliminary DTypeMeta class and np.dtype subclasses
seberg 4a080dc
Possible initialization safety fixups and fix API hash.
seberg 5ced904
Small fixups/comments
seberg 63ed08c
Create a static prototype to copy, so that it is more obvious what th…
seberg c3c0786
STY: Just small indentation fixup
seberg e02cae8
Add tests and fixup __name__
seberg 6d951be
Use "parametric" instead of "flexible" and add tests for attributes
seberg 7c36544
Improve docs and test slightl; Reject also kwargs in dtype from type …
seberg e6fde0e
PyDict_GET_SIZE is not public (or at least not on older python)
seberg 2ea745b
small fixups/name changes
seberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
#include "npy_sort.h" | ||
#include "common.h" | ||
#include "ctors.h" | ||
#include "dtypemeta.h" | ||
#include "lowlevel_strided_loops.h" | ||
#include "usertypes.h" | ||
#include "_datetime.h" | ||
|
@@ -4358,6 +4359,17 @@ set_typeinfo(PyObject *dict) | |
PyArray_Descr *dtype; | ||
PyObject *cobj, *key; | ||
|
||
/* | ||
* Override the base class for all types, eventually all of this logic | ||
* should be defined on the class and inherited to the scalar. | ||
* (NPY_HALF is the largest builtin one.) | ||
*/ | ||
for (i = 0; i <= NPY_HALF; i++) { | ||
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. nit: looks like NPY_NTYPES seems to be the upper limit here. For example, if we were to add a new builtin type that would be added after NPY_HALF? doubt, if this even happens to even worry about ? |
||
if (dtypemeta_wrap_legacy_descriptor(_builtin_descrs[i]) < 0) { | ||
return -1; | ||
} | ||
} | ||
|
||
/* | ||
* Add cast functions for the new types | ||
*/ | ||
|
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
Oops, something went wrong.
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.
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.
The API generation changes are the ugliest part here... Unfortunately, I really want to hide everything away (unless it is an internal build), and have the
PyArrayDescr_Type
defined asPyTypeObject
even internally. But I also need to initialize/allocate it statically as aPyArray_DTypeMeta
.