Skip to content

Conversation

@jorenham
Copy link
Member

@jorenham jorenham commented May 17, 2025

this fixes the following valid example from being falsely rejected by static type checkers

import numpy as np

a = np.array([0, None], np.timedelta64)
a.__itruediv__(3.14)
a.__ifloordiv__(3.14)

This was typed correctly in the __{true,floor}div__ methods, which apparently made it so that a /= 3.14 and a /= 3.14 already was accepted. So that's probably why this issue wasn't noticed before.

@jorenham jorenham added this to the 2.3.0 release milestone May 17, 2025
@charris charris merged commit c2d5e00 into numpy:main May 19, 2025
77 checks passed
@charris
Copy link
Member

charris commented May 19, 2025

Thanks Joren.

@jorenham jorenham deleted the typing/ndarray-timedelta64-idiv branch May 19, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants