Skip to content

TYP: fix ndarray.__array__ annotation for copy #29204

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
Jun 13, 2025

Conversation

jorenham
Copy link
Member

closes #29203

@jorenham jorenham added 09 - Backport-Candidate PRs tagged should be backported 41 - Static typing labels Jun 13, 2025
Copy link

Diff from mypy_primer, showing the effect of this PR on type check results on a corpus of open source code:

xarray (https://github.com/pydata/xarray)
+ xarray/tests/test_namedarray.py: note: In member "test_duck_array_class" of class "TestNamedArray":
+ xarray/tests/test_namedarray.py:377: error: Argument 1 to "check_duck_array_typevar" has incompatible type "MaskedArray[Any, dtype[signedinteger[_64Bit]]]"; expected "_arrayfunction[Any, Never] | _arrayapi[Any, Never]"  [arg-type]
+ xarray/tests/test_namedarray.py: note: In class "TestNamedArray":

@seberg seberg merged commit 0b74c62 into numpy:main Jun 13, 2025
73 checks passed
@seberg
Copy link
Member

seberg commented Jun 13, 2025

Thanks Joren.

@jorenham jorenham deleted the typing/ndarray.__array__ branch June 13, 2025 19:25
charris pushed a commit to charris/numpy that referenced this pull request Jun 17, 2025
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jun 17, 2025
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.

TYP: typehints for __array__
3 participants