$ ./python.exe -c 'lazy from typing import ForwardRef; print(ForwardRef)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
lazy from typing import ForwardRef; print(ForwardRef)
ImportError: deferred import of 'typing.ForwardRef' raised an exception during resolution
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
lazy from typing import ForwardRef; print(ForwardRef)
^^^^^^^^^^
ImportError: cannot import name 'ForwardRef' from 'typing' (/Users/jelle/py/cpython/Lib/typing.py)
Bug report
Bug description:
typing.ForwardRefis defined through a module__getattr__. This breaks with lazy imports:CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS