Skip to content

Conversation

charris
Copy link
Member

@charris charris commented Apr 14, 2025

Backport of #28699.

partial port of numpy/numtype#508


Static type-checkers currently reject abs(np.array([1], np.object_)), even though it is a valid runtime expression. This adds an __abs__ method to np.object_, indirectly causing type-checkers to accept calls to NDArray[object_].__abs__ as well.

@charris charris added 08 - Backport Used to tag backport PRs 41 - Static typing numtype Isssue/PR related to numpy/numtype labels Apr 14, 2025
@charris charris added this to the 2.2.5 release milestone Apr 14, 2025
@charris charris merged commit 202732d into numpy:maintenance/2.2.x Apr 14, 2025
70 checks passed
@charris charris deleted the backport-28699 branch April 14, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
08 - Backport Used to tag backport PRs 41 - Static typing numtype Isssue/PR related to numpy/numtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants