[issue42377] allow typing.cast with TYPE_CHECKING

2020-11-16 Thread Daniel Pinyol
Change by Daniel Pinyol : -- nosy: dpinol priority: normal severity: normal status: open title: allow typing.cast with TYPE_CHECKING type: behavior versions: Python 3.9 ___ Python tracker <https://bugs.python.org/issue42

[issue42377] allow typing.cast with TYPE_CHECKING

2020-11-16 Thread Daniel Pinyol
New submission from Daniel Pinyol : Executing the following code we get this error on the "cast" call NameError: name 'A' is not defined ``` from __future__ import annotations from typing import TYPE_CHECKING, Optional, cast if TYPE_CHECKING: class A: pass def