Skip to content

TYP: accept non-integer shapes in array constructor without a dtype #28498

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

Conversation

jorenham
Copy link
Member

@jorenham jorenham commented Mar 14, 2025

The mypy_primer output from #28497 (comment) shows that calling np.zeros with tuple[int, np.int64] results in a typing error. This PR intended to address that.

But for some reason, I wasn't able to reproduce this error, and tese changes also did not result in a mypy_primer diff 🤷🏻

Either way, even if these changes don't actually fix this specific problem, I can imagine that there are some theoretical edge-cases where will help, although those are probably rather unlikely use-cases.

These changes are backwards compatible, and there are no other downsides that this would cause, as far as I can tell.

@jorenham jorenham added 09 - Backport-Candidate PRs tagged should be backported 41 - Static typing labels Mar 14, 2025
@jorenham jorenham added this to the 2.2.4 release milestone Mar 14, 2025
@jorenham
Copy link
Member Author

note to self: this has already been fixed in numtype

@jorenham

This comment was marked as outdated.

@jorenham jorenham marked this pull request as draft March 14, 2025 05:21
@jorenham jorenham marked this pull request as ready for review March 14, 2025 14:47
@jorenham jorenham removed the 09 - Backport-Candidate PRs tagged should be backported label Mar 14, 2025
@jorenham jorenham removed this from the 2.2.4 release milestone Mar 14, 2025
@jorenham jorenham force-pushed the typing/fix-array-constructor-shape-default branch from 5b1bd95 to 13e21ac Compare March 15, 2025 20:53
@charris charris merged commit 939effb into numpy:main Mar 24, 2025
74 checks passed
@jorenham jorenham deleted the typing/fix-array-constructor-shape-default branch March 24, 2025 22:55
@charris
Copy link
Member

charris commented Mar 24, 2025

Thanks Joren.

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