Fix caching of UnionType instead of resolved typing.Union

This commit is contained in:
Bryan Forbes
2022-03-28 15:24:03 -05:00
committed by GitHub
parent 9012c424bf
commit 8524bfb54d
2 changed files with 60 additions and 3 deletions

View File

@ -1032,9 +1032,9 @@ def evaluate_annotation(
if implicit_str and isinstance(tp, str):
if tp in cache:
return cache[tp]
evaluated = eval(tp, globals, locals)
evaluated = evaluate_annotation(eval(tp, globals, locals), globals, locals, cache)
cache[tp] = evaluated
return evaluate_annotation(evaluated, globals, locals, cache)
return evaluated
if hasattr(tp, '__args__'):
implicit_str = True