-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-1-normal
Description
Simple example:
from six import PY2
if PY2 and any({'foo': 'bar'}.iterkeys()): # error: Dict[str, str] has no attribute "iterkeys" when checking py3
pass
if PY2:
if any({'foo': 'bar'}.iterkeys()): # No error
pass
Note: The same thing applies to PY3 when run with --py2
Sometimes it's cumbersome to split it when you have a series of if, elif, else cases, like this:
if isinstance(node, ast.Name):
...
elif isinstance(node, ast.Num):
...
elif PY3 and isinstance(node, ast.Starred):
...
else:
// unhandled node type!
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-1-normal