You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<string>:1: note: In module imported here:
.../lib/mypy/typeshed/stdlib/3/urllib/request.pyi: note: In class "Request":
.../lib/mypy/typeshed/stdlib/3/urllib/request.pyi:36: error: Callable[[Request], str] has no attribute "setter"
I looked at the relevant code in typeshed/stdlib/3/urllib/request.pyi:
Thanks for the bug report! I should have a fix for this shortly.
This isn't actually to do with the fast parser's understanding of version checks. What's actually going on is this: mypy's current parser combines repeated decorated function definitions with the same name into an OverloadedFunctionDef object, without checking if they're actually overloads. The (later) code that understands properties assumes this is the case. The faster parser only does this overload fixup at the top level of class definitions, so it's not happening when you wrap the property in an if statement.
Incidentally, this means that properties won't work properly if the lines aren't contiguous.
mypy --fast-parser -c "import urllib.request"
outputs:I looked at the relevant code in typeshed/stdlib/3/urllib/request.pyi:
I use python 3.4. I removed the version check like this:
Then there was no error message.
It looks like mypy's fast parser is having trouble with the version check.
The text was updated successfully, but these errors were encountered: