Guido van Rossum <[email protected]> added the comment:
Here's a patch that doesn't do it right but illustrates the point:
diff --git a/Lib/typing.py b/Lib/typing.py
index 972b8ba24b..4616db60c3 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -1807,6 +1807,12 @@ def get_type_hints(obj, globalns=None, localns=None,
include_extras=False):
value = type(None)
if isinstance(value, str):
value = ForwardRef(value, is_argument=False, is_class=True)
+ elif isinstance(value, types.GenericAlias):
+ args = tuple(
+ ForwardRef(arg) if isinstance(arg, str) else args
+ for arg in value.__args__
+ )
+ value = value.__origin__[(*args,)]
value = _eval_type(value, base_globals, base_locals)
hints[name] = value
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41370>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com