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

Segmentation fault with recursive type #17236

Closed
RbCaVi opened this issue May 13, 2024 · 0 comments · Fixed by #17353
Closed

Segmentation fault with recursive type #17236

RbCaVi opened this issue May 13, 2024 · 0 comments · Fixed by #17353

Comments

@RbCaVi
Copy link

RbCaVi commented May 13, 2024

Crash Report

Compiled mypy has a segmentation fault.

Traceback

(Too many lines to copy)

To Reproduce

import typing

T1 = typing.NewType('T1',str)
T2 = tuple[T1,'T4','T4']
T3 = tuple[str,'T4','T4']
T4 = T2 | T3

Your Environment

  • Mypy version used: master (mypy 1.11.0+dev.35fbd2a852be2c47e8006429afe9b3ad4b1bfac2 (compiled: no))
  • Mypy command-line flags: mypy test.py --show-traceback
  • Mypy configuration options from mypy.ini (and other config files): No config files
  • Python version used: 3.12 (compiled from source)
  • Operating system and version: CentOS 7
@RbCaVi RbCaVi added the crash label May 13, 2024
@RbCaVi RbCaVi changed the title Crash on recursive type Segmentation fault on recursive type May 13, 2024
@RbCaVi RbCaVi changed the title Segmentation fault on recursive type Segmentation fault with recursive type May 13, 2024
ilevkivskyi added a commit that referenced this issue Jun 9, 2024
Fixes #17236

It turns out we were calculating tuple fallbacks where we don't really
need to. We can rely on the fact that tuple fallback is trivial for
non-trivial partial fallbacks to simplify the logic and avoid the
infinite recursion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants