python 3.7 RecursionError when using recursive typing definition and get_type_hints · Issue #574 · python/typing (original) (raw)

@reinhrst

The following code gives a RecursionError in python 3.7.0 (runs fine in 3.6.4, giving the answer {'return': typing.Sequence[typing.Union[str, typing.Sequence[typing.Union[str, _ForwardRef('Foo')]]]]})

import typing

Foo = typing.Sequence[typing.Union[str, "Foo"]]

def a() -> Foo:
   ...

typing.get_type_hints(a)