Skip to content

TYP: allow inplace division of NDArray[timedelta64] by floats #28994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy