Skip to content

segfault on recursive generic function class #18219

@CharlesFauman

Description

@CharlesFauman

Crash Report

Seg fault

Traceback

$ mypy . --show-traceback
Segmentation fault (core dumped)

To Reproduce

(Write what you did to reproduce the crash. Full source code is
appreciated. We also very much appreciate it if you try to narrow the
source down to a small stand-alone example.)

from __future__ import annotations
from typing import Callable

class Wrapper:
    def __call__[**P, T](
        self,
        func: Callable[P, T] | None = None,
    ) -> Callable[P, T] | Wrapper:
        if func is not None:
            return func

        return Wrapper()

Your Environment

  • Mypy version used: 1.13.0
  • Mypy command-line flags: N/A
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.13.0
  • Operating system and version: wsl 2.3.26.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions