Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL ERROR: maximum semantic analysis iteration count reached on self-referential union #17132

Open
kmurphy4 opened this issue Apr 17, 2024 · 0 comments

Comments

@kmurphy4
Copy link

Crash Report

Under some specific conditions, mypy crashes when creating type aliases for unions with self-referential variants.

Specifically, both of these work fine:

X: ty.TypeAlias = ty.Union[
    ty.Set["X"],
    ty.Sequence["X"],
]

Y: ty.TypeAlias = ty.Union[
    ty.Sequence[ty.Optional["Y"]],
]

but this crashes:

Z: ty.TypeAlias = ty.Union[
    ty.Set["Z"],
    ty.Sequence[ty.Optional["Z"]],
]

with

main.py: error: INTERNAL ERROR: maximum semantic analysis iteration count reached

To Reproduce

https://mypy-play.net/?mypy=1.9.0&python=3.12&flags=show-traceback&gist=5f48179cab35cd594aca11d797bf530d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants