Skip to content

(🐞) Silent crash regression in 1.2 with complex Concatenate return value #15073

Closed
@KotlinIsland

Description

@KotlinIsland

Crash Report

Absolutely nothing.

Traceback

N/A

To Reproduce

from typing import TypeVar, Callable, Concatenate, ParamSpec

R = TypeVar("R")
P = ParamSpec("P")

def f(
) -> Callable[[Callable[Concatenate[Callable[P, R], P], R]], Callable[P, R]]:
    def r(fn: Callable[Concatenate[Callable[P, R], P], R]) -> Callable[P, R]:
        pass
    return r

playground

Your Environment

  • Mypy version used: 1.2.0
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.11.3
  • Operating system and version: Windows version 10

Why?

This is because of an infinite recursion in mypy.expandtype.ExpandTypeVisitor.visit_callable_type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions