Skip to content

INTERNAL ERROR when using typing.ParamSpec #16257

@evhub

Description

@evhub

Crash Report

MyPy INTERNAL ERROR when running reproduction code below.

Traceback

break_mypy.py:32: error: An overloaded function outside a stub file must have an implementation  [no-overload-impl]
break_mypy.py:32: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.6.0
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "mypy\checker.py", line 585, in accept
  File "mypy\nodes.py", line 588, in accept
  File "mypy\checker.py", line 622, in visit_overloaded_func_def
  File "mypy\checker.py", line 652, in _visit_overloaded_func_def
  File "mypy\checker.py", line 762, in check_overlapping_overloads
  File "mypy\checker.py", line 7268, in is_unsafe_overlapping_overload_signatures
  File "mypy\subtypes.py", line 1425, in is_callable_compatible
  File "mypy\subtypes.py", line 1749, in unify_generic_callable
  File "mypy\applytype.py", line 129, in apply_generic_arguments
  File "mypy\expandtype.py", line 71, in expand_type
  File "mypy\types.py", line 1953, in accept
  File "mypy\expandtype.py", line 342, in visit_callable_type
  File "mypy\types.py", line 1877, in copy_modified
  File "mypy\types.py", line 1811, in __init__
AssertionError:
break_mypy.py:32: : note: use --pdb to drop into pdb

To Reproduce

Reproduction code:

from typing import *

_T = TypeVar("_T")
_U = TypeVar("_U")
_V = TypeVar("_V")
_W = TypeVar("_W")
_P = ParamSpec("_P")

@overload
def call(
    _func: Callable[Concatenate[_T, _P], _U],
    _x: _T,
    *args: Any,
    **kwargs: Any,
) -> _U: ...
@overload
def call(
    _func: Callable[Concatenate[_T, _U, _P], _V],
    _x: _T,
    _y: _U,
    *args: Any,
    **kwargs: Any,
) -> _V: ...

Your Environment

  • Mypy version used: mypy 1.6.0 (compiled: yes)
  • Mypy command-line flags: --show-traceback
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: Python 3.11.4
  • Operating system and version: Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions