-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
no-implicit-reexport ignores issues after calling numpy.cross in a function #12350
Copy link
Copy link
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-implicit-reexportThe --no-implicit-reexport optionThe --no-implicit-reexport option
Description
Bug Report
When passing the --no-implicit-reexport flag to mypy the following code does not generate any errors and does not reveal a type:
import numpy
from numpy.typing import ArrayLike
def test_method() -> None:
value: ArrayLike = numpy.cross(numpy.array([1, 2, 3]), numpy.array([4, 5, 6]))
reveal_type(value)
broken: int = 'test'The issue remains if the method is called directly as numpy.core.numeric.cross.
If the flag --no-implicit-reexport is not supplied the errors are generated correctly.
Interestingly if the code is not in a method the error is reported. This made me think that the issue might not be with numpy but mypy.
To Reproduce
- Install dependencies
pip install mypy==0.940 numpy==1.22.3 - Create a file
test.pyas mentioned above mypy test.py-> errors are shownmypy --no-implicit-reexport test.py-> no errors are shown
Expected Behavior
Both calls should raise the same errors.
Actual Behavior
The call with the --no-implicit-reexport flag does not show any errors.
Your Environment
- Mypy version used: 0.940 and 0.931
- Mypy configuration options from
mypy.ini(and other config files): No configuration file - Python version used: 3.10.2
- Operating system and version:
Linux-5.10.102-1-MANJARO-x86_64-with-glibc2.35(as returned byplatform.platform()) but it also fails with the docker imagepython:3.10.2-slim
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-implicit-reexportThe --no-implicit-reexport optionThe --no-implicit-reexport option