Martijn Pieters added the comment:

> I wonder why they forward references are evaluated *at all* at this point. 

The Union type tries to reduce the set of allowed types by removing any 
subclasses (so Union[int, bool] becomes Union[int] only). That's all fine, but 
it should not at that point fail if a forward reference is not available yet.

Arguably, the except NameError there should be converted to a except Exception, 
since forward references are supposed to be *a valid Python expression [...] 
and it should evaluate without errors once the module has been fully loaded.* 
(from the PEP); anything goes, and thus any error goes until the module is 
loaded.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26477>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to