Skip to content

mypy 0.990 crashes with segmentation fault on hydra_zen due to recursive types #14031

Closed
@rsokl

Description

@rsokl

Crash Report

Upgrading from mypy 0.982 to 0.990 leads to a segmentation fault when I run on a file that merely imports hydra_zen:

import hydra_zen

This appears to be related to hydra-zen's use of recursive types and mypy 0.990 enabling these by default. To confirm, I reverted to 0.982 and configured then enable_recursive_aliases = true and confirmed that this also produces a segmentation fault.

This is the recursive type that is creating the issue. Oddly, when I specifically remove Sequence["SupportedPrimitive"] from the union (comment out line 223), the issue goes away. I spent time trying to further isolate the culprit and create a minimal example, but I was unable to decouple the issue from hydra_zen.

Traceback

Segmentation fault

To Reproduce

rsokl@Maxwell:/tmp$ pip install hydra-zen==0.8.0 mypy==0.990
rsokl@Maxwell:/tmp$ echo "import hydra_zen" > foo.py
rsokl@Maxwell:/tmp/hydra-zen$ mypy foo.py
Segmentation fault

Your Environment

  • Mypy version used: 0.990
  • Mypy command-line flags: (None)
  • Mypy configuration options from mypy.ini (and other config files): (None)
  • Python version used: python-3.9.13-haa1d7c7_2
  • Operating system and version: Ubuntu 20.04.4 LTS (GNU/Linux 5.10.102.1-microsoft-standard-WSL2 x86_64)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions