-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
The second import xxx as os
generates an error, though it's similar to the first import, which doesn't generate an error:
import sys
def f() -> None:
if sys.platform == 'xyz': # Nonsensical platform
import xxx as os # No error
else:
import os
class A:
def g(self) -> None:
if sys.platform == 'xyz':
import xxx as os # Error
else:
import os
The culprit is semantic analyzer pass 1, which only recurses into top-level functions but not into methods.
Metadata
Metadata
Assignees
Labels
No labels