Skip to content

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

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)

Activity

  1. changed the title [-]python 3.7 max recursion when using recursive typing definition and get_type_hints[/-] [+]python 3.7 RecursionError when using recursive typing definition and get_type_hints[/+] on Jul 25, 2018
  2. ilevkivskyi commented on Aug 1, 2018

    @ilevkivskyi
    Member

    Thanks for reporting! I think this may be related to recent fixes to interaction between get_type_hints and from __future__ import annotations. The fix for this regression may be non-trivial, so I would prefer to wait for @ambv opinion here.

  3. srittau commented on Nov 4, 2021

    @srittau
    Collaborator

    As the typing module is not part of Python, please file a bug report at bugs.python.org if this is still an issue.

  4. added a commit that references this issue on Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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