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

Crash: decorator using TypeVarTuple #15667

Closed
shaunc opened this issue Jul 14, 2023 · 0 comments · Fixed by #15924
Closed

Crash: decorator using TypeVarTuple #15667

shaunc opened this issue Jul 14, 2023 · 0 comments · Fixed by #15924
Labels
crash topic-pep-646 PEP 646 (TypeVarTuple, Unpack)

Comments

@shaunc
Copy link

shaunc commented Jul 14, 2023

Crash Report

When checking the file below, which defines a decorator using TypeVarTuple, mypy crashes. Tested on latest "wheels".

Traceback

 % mypy src/crypto_features/features/trades/test.py --show-traceback
src/crypto_features/features/trades/test.py:10: 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.5.0+dev.2ebd51e881490f4d20635cde92ef9e3edbbad68c
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 5141, in accept
  File "mypy/nodes.py", line 1903, in accept
  File "mypy/checkexpr.py", line 439, in visit_call_expr
  File "mypy/checkexpr.py", line 559, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1349, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1432, in check_call
  File "mypy/checkexpr.py", line 1623, in check_callable_call
  File "mypy/checkexpr.py", line 2286, in check_argument_types
AssertionError: 
src/crypto_features/features/trades/test.py:10: : note: use --pdb to drop into pdb

To Reproduce

File:

from typing import TypeVarTuple, TypeVar, Callable, Unpack


TT = TypeVarTuple("TT")
T = TypeVar("T")


def decorator(f: Callable[[Unpack[TT]], T]) -> Callable[[Unpack[TT]], T]:
    def wrapper(*args: Unpack[TT]) -> T:
        return f(*args)

    return wrapper


@decorator
def f(a: int, b: int) -> int:
    return a + b

Your Environment

  • Mypy version used:
    version: 1.5.0+dev.2ebd51e881490f4d20635cde92ef9e3edbbad68c
    Also tried with 1.4.1

  • Mypy command-line flags: Just " --show-traceback"

  • Mypy configuration options from mypy.ini (and other config files):

In pyproject.toml:

[tool.mypy]
allow_untyped_calls = false
enable_incomplete_feature = ["TypeVarTuple", "Unpack"]
follow_imports = "skip"
ignore_missing_imports = true
plugins = "numpy.typing.mypy_plugin"
  • Python version used: Python 3.11.3
  • Operating system and version: Macos: 13.4.1 (22F82)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash topic-pep-646 PEP 646 (TypeVarTuple, Unpack)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants