Skip to content

python 3.7 RecursionError when using recursive typing definition and get_type_hints #574

@reinhrst

Description

@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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions