Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

TYP: default to dtype[Any] #28669

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 2 commits into from
Apr 9, 2025

Conversation

jorenham
Copy link
Member

@jorenham jorenham commented Apr 7, 2025

No description provided.

@jorenham jorenham added 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes 41 - Static typing labels Apr 7, 2025
jorenham added a commit to jorenham/numpy that referenced this pull request Apr 7, 2025
jorenham added a commit to jorenham/numpy that referenced this pull request Apr 7, 2025
@jorenham jorenham force-pushed the typing/dtype-type-parameter-default branch from 1be93d2 to c48b082 Compare April 7, 2025 20:34
@jorenham jorenham added this to the 2.3.0 release milestone Apr 7, 2025
@jorenham jorenham force-pushed the typing/dtype-type-parameter-default branch from c48b082 to 4b3a6b4 Compare April 7, 2025 21:31
@jorenham jorenham removed the 56 - Needs Release Note. Needs an entry in doc/release/upcoming_changes label Apr 8, 2025
@charris charris merged commit 74303b6 into numpy:main Apr 9, 2025
74 checks passed
@charris
Copy link
Member

charris commented Apr 9, 2025

Thanks Joren.

@jorenham jorenham deleted the typing/dtype-type-parameter-default branch April 9, 2025 22:36
MaanasArora pushed a commit to MaanasArora/numpy that referenced this pull request Apr 11, 2025
@fzimmermann89
Copy link

fzimmermann89 commented Jun 10, 2025

Is this the change that causes mypy unreachable warnings in code like this

match array.dtype:
   case np.int:
      ...
   case np.float:
     ...

?

@jorenham
Copy link
Member Author

Is this the change that causes mypy unreachable warnings in code like this

match array.dtype:
   case np.int:
      ...
   case np.float:
     ...

?

np.float and np.int do not exist, so that might be why

@jorenham
Copy link
Member Author

@fzimmermann89
Copy link

fzimmermann89 commented Jun 11, 2025

Sorry, the actual code is:

  match data.dtype:
         case np.uint16:
                    data = data.astype(np.int32)
         case np.uint32 | np.uint64:
                    data = data.astype(np.int64)

This works in mypy with numpy <2.2, but breaks in numpy 2.3.

But the issue is caused by array.dtype no longer being Any -- sorry.

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.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.