Closed
Description
Using version 0.770, I had some code passing type checking just fine, but now using 0.780 the same code yields "object" not callable
. the code in question is the expression Union[bytes, str](returned)
.
Did 0.780 change a Union
from callable to non-callable? Or was it always non-callable and just not flagged before? Or what?
4Jun13:16:39 /$ mypy --version
mypy 0.770
4Jun13:16:45 /$ mypy -c "from typing import Union; Union[str, bytes]('')"
Success: no issues found in 1 source file
4Jun13:17:01 /$ pip install --upgrade mypy
Collecting mypy
Using cached mypy-0.780-cp37-cp37m-manylinux1_x86_64.whl (20.2 MB)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.7.4 in /home/gene/.pythonz/pythons/CPython-3.7.2/lib/python3.7/site-packages (from mypy) (3.7.4.2)
Requirement already satisfied, skipping upgrade: mypy-extensions<0.5.0,>=0.4.3 in /home/gene/.pythonz/pythons/CPython-3.7.2/lib/python3.7/site-packages (from mypy) (0.4.3)
Requirement already satisfied, skipping upgrade: typed-ast<1.5.0,>=1.4.0 in /home/gene/.pythonz/pythons/CPython-3.7.2/lib/python3.7/site-packages (from mypy) (1.4.1)
Installing collected packages: mypy
Attempting uninstall: mypy
Found existing installation: mypy 0.770
Uninstalling mypy-0.770:
Successfully uninstalled mypy-0.770
Successfully installed mypy-0.780
4Jun13:17:29 /$ mypy -c "from typing import Union; Union[str, bytes]('')"
<string>:1: error: "object" not callable
Found 1 error in 1 file (checked 1 source file)
I checked the release notes for 0.780 and didn't see anything that seemed relevant to me...
I'm not sure what behavior to expect. I don't have that good of a grasp of Python type checking. Should a Union
be callable, the way any other type like int
or str
are? Or not? 🤷♂️
I'm using Python 3.7.something. (3.7.2 locally, possibly a different version in my CI, where this is also happening.)
Metadata
Metadata
Assignees
Labels
No labels