Skip to content

mypy does not support PEP 612 -- Parameter Specification Variables (python 3.10) #11295

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

Closed
rvaquerizor opened this issue Oct 8, 2021 · 2 comments
Labels
bug mypy got something wrong

Comments

@rvaquerizor
Copy link

Bug Report

mypy does not support python 3.10 PEP 612 - Parameter Specification Variables

To Reproduce

  1. Create a python module with the content:
from typing import Callable, TypeVar, ParamSpec


T = TypeVar('T')
R = tuple[T, float]
P = ParamSpec('P')


def decorator_block(func: Callable[P, T]) -> Callable[P, R]:
    """
    Decorator.
    """
    def wrapper(*args, **kwargs) -> R:
        result = func(*args, **kwargs)
        return result, 0.1
    return wrapper
  1. Execute mypy on the file just created above.

Expected Behavior

No complains from mypy. All new features in python 3.10 should be supported.

Actual Behavior

mypy complains whenever I use Param Spec variables with the following message:

new_file.py:9: error: The first argument to Callable must be a list of types or "..."

My Environment

  • Mypy version used: 0.812
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): dependencies: mypy-extensions >=0.4.3,<0.5.0, typed-ast >=1.4.0,<1.5.0, typing-extensions >=3.7.4
  • Python version used: 3.10
  • Operating system and version: Ubuntu 5.11.0-37-generic Refactor code into packages #41-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

__

@rvaquerizor rvaquerizor added the bug mypy got something wrong label Oct 8, 2021
@JelleZijlstra
Copy link
Member

#8645

@JelleZijlstra
Copy link
Member

Also, 0.812 is quite old. There is some (very) rudimentary support for ParamSpec in newer releases I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants