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
{{ message }}
Repository navigation
sys.version_info check fails with --fast-parser #1708
<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.
Activity
sharmaeklavya2 commentedon Jun 14, 2016
Because of this bug,
six.movescannot be used with--fast-parserin python 3 mode.ddfisher commentedon Jun 15, 2016
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
OverloadedFunctionDefobject, 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.
Check all blocks for overloads in the fast parser (#1718)