Open
Description
Bug Report
This file:
from dataclasses import dataclass
import collections
@dataclass
class Shadow:
collections: collections.deque
other: collections.defaultdict
print(Shadow(collections.deque(), collections.defaultdict()))
is perhaps a bit unorthodox, but runs fine, because the collections: ...
doesn't actually shadow the module when defining other
.
Actual Behavior
mypy v0.950 was happy with it, but mypy v0.960 claims that:
test.py:9: error: Name "collections.defaultdict" is not defined
Introducing commit
Bisected to 03901ef ("Running dataclass transform in a later pass to fix crashes (#12762)", @JukkaL)
Your Environment
- Mypy version used: v0.960
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini
(and other config files): none - Python version used: 3.10.4
- Operating system and version: Archlinux