-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Milestone
Description
Bug summary
Mypy has started reporting errors without any obvious changes on our side.
Code for reproduction
Any current CI run. E.g. https://github.com/matplotlib/matplotlib/actions/runs/12233488667/job/34120690881?pr=29052
Actual outcome
lib/matplotlib/pylab.py:48: error: Name "fft" already defined (by an import) [no-redef]
lib/matplotlib/pylab.py:49: error: Name "random" already defined (by an import) [no-redef]
lib/matplotlib/pylab.py:49: error: Incompatible import of "power" (imported name has type overloaded function, local name has type "_UFunc_Nin2_Nout1[Literal['power'], Literal[[18](https://github.com/matplotlib/matplotlib/actions/runs/12233488667/job/34120690881?pr=29052#step:6:19)], None]") [assignment]
lib/matplotlib/pylab.py:50: error: Name "outer" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Name "trace" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Name "diagonal" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Name "cross" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Incompatible import of "matmul" (imported name has type overloaded function, local name has type "_GUFunc_Nin2_Nout1[Literal['matmul'], Literal[[19](https://github.com/matplotlib/matplotlib/actions/runs/12233488667/job/34120690881?pr=29052#step:6:20)], None, Literal['(n?,k),(k,m?)->(n?,m?)']]") [assignment]
lib/matplotlib/pylab.py:63: error: Cannot assign to a type [misc]
Found 9 errors in 1 file (checked 108 source files)
lib/matplotlib/pylab.py:48: error: Name "fft" already defined (by an import) [no-redef]
lib/matplotlib/pylab.py:49: error: Name "random" already defined (by an import) [no-redef]
lib/matplotlib/pylab.py:49: error: Incompatible import of "power" (imported name has type overloaded function, local name has type "_UFunc_Nin2_Nout1[Literal['power'], Literal[18], None]") [assignment]
lib/matplotlib/pylab.py:50: error: Name "outer" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Name "trace" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Name "diagonal" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Name "cross" already defined (possibly by an import) [no-redef]
lib/matplotlib/pylab.py:50: error: Incompatible import of "matmul" (imported name has type overloaded function, local name has type "_GUFunc_Nin2_Nout1[Literal['matmul'], Literal[19], None, Literal['(n?,k),(k,m?)->(n?,m?)']]") [assignment]
lib/matplotlib/pylab.py:63: error: Cannot assign to a type [misc]
Suspicion
The questionable lines are
from numpy import *
from numpy.fft import *
from numpy.random import *
from numpy.linalg import *
Either mypy has changed behavior or change of numpy imports are responsible. Note that numpy 2.2 has been released yesterday, and it includes this PR changing imports numpy/numpy#24357.
Metadata
Metadata
Assignees
Labels
No labels