Skip to content
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

mypy infers Any for numpy 2.2.2. expressions that worked with 2.2.1 #18496

Open
bersbersbers opened this issue Jan 21, 2025 · 2 comments
Open
Labels
bug mypy got something wrong

Comments

@bersbersbers
Copy link

Bug Report

mypy infers Any for several numpy expressions after upgrading to numpy==2.2.2

See also

To Reproduce

from typing import reveal_type

import numpy as np

reveal_type(np.maximum(np.array(1), np.array(1)))

Expected Behavior

ndarray[tuple[int, ...], dtype[Any]]

Actual Behavior

Any

Your Environment

This works with numpy==2.2.1; also, it works with pyright. So it seems to be specific to numpy==2.2.2 and mypy.

  • Mypy version used: mypy 1.14.1 (compiled: yes)
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.13.1
@JelleZijlstra
Copy link
Member

For reference here's the diff between 2.2.1 and 2.2.2: numpy/numpy@v2.2.1...v2.2.2 . Rather a lot of changes to __init__.pyi; I haven't attempted to work out what might be causing the change.

@bersbersbers
Copy link
Author

I'd look at numpy/numpy#28176 first, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants