{{ message }}
ENH: ArrayMethod sorts for builtin dtypes#31273
Closed
MaanasArora wants to merge 2 commits into
Closed
Conversation
MaanasArora
commented
Apr 19, 2026
Contributor
Author
There was a problem hiding this comment.
Leaking, but causes a segfault when I decref...
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.

Adds new-style sorting and argsorting array-methods (#29737) to built-in NumPy dtypes (bools, integers, floats, dates; there are methods for string/unicode but not registered yet). This allows the new path in
PyArray_Sortto be functional for these, which will enable writing descending sorts soon after this. ping @seberg @mhvk - thanks!Happy to add descending sorts in this PR if it doesn't make this too hard to read, there are just a lot of (repetitive) lines with this direction. I tried reducing duplication, but seems unfortunately hard to do because of the C++ templating, and I actually somewhat prefer this so far just to keep the new/old sorts quite separate.
Still have to check the resolve descriptors setup and string/unicode quirks, but otherwise this is basically complete.
AI Disclosure
I used Claude to fill in the
*sort_loopfunctions with the new signatures. I gave it the bool + existing code for each (arg)sort kind and let it generate the rest, then looked briefly but didn't find any inconsistencies, but will keep an eye.