Skip to content

Conversation

@charris
Copy link
Member

@charris charris commented Sep 23, 2025

Backport of #29761.

The key used to sort np.ScalarType is not unique (e.g. int64 and longlong on linux both have key ('i', '8')). To remove duplicates, set is used, whose iteration order depends on the hashes of the containing scalartype classes. So in case of ties, the hash would be the tiebreaker. The problem is that these hashes are arbitrary, leading to differences in ScalarType order between platforms, python versions, machines, etc.

In case you're wondering why I care: Stubtest is currently reporting errors for ScalarType for certain platform and python versions: https://github.com/numpy/numtype/actions/runs/17778048694/job/50530549124?pr=706. And I'm sure you can imagine that it wasn't easy to figure out what was going on here (especially if you consider the stubtest error spaghetti output, but I digress). Hence the pedantic "backport candidate" label ;)

@charris charris added this to the 2.3.4 release milestone Sep 23, 2025
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Sep 23, 2025
@charris charris merged commit 5719fa9 into numpy:maintenance/2.3.x Sep 24, 2025
79 of 80 checks passed
@charris charris deleted the backport-29761 branch September 24, 2025 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

00 - Bug 08 - Backport Used to tag backport PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants