Skip to content

Conversation

@asmeurer
Copy link
Member

@asmeurer asmeurer commented Aug 3, 2021

In #12658 and #15068 the sort ordering for datetime and timedelta was changed
so that NaT sorts to the end, but the internal compare array function was not
updated.

Fixes #19574.

If a test should be added for this, please let me know where.

…edelta

In numpy#12658 and numpy#15068 the sort ordering for datetime and timedelta was changed
so that NaT sorts to the end, but the internal compare array function was not
updated.

Fixes numpy#19574.
I accidentally based it off the float compare template instead of the integer
compare template. It also now properly handles the case when both arguments
are NaT.
@charris charris merged commit 672a2ec into numpy:main Aug 3, 2021
@charris
Copy link
Member

charris commented Aug 4, 2021

Thanks @asmeurer . This probably maybe could be tested using an object array containing time* types, something like

In [20]: a = array([timedelta64('NaT'), timedelta64(0)], dtype=object)          

In [21]: a.sort() 

But that is hard to check without merging this.

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Oct 6, 2021
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Oct 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PyArray_CompareFunc of dtype datetime64 returns incorrect value for 'NaT' objects.

2 participants