GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Type variable reported unbound when only a ParamSpec alias's return type uses it and its ParamSpec slot is not a ParamSpec · Issue #22399 · python/mypy Open Labels bugmypy got something wrongmypy got something wrong DescriptionTitle: Type variable reported unbound when only a ParamSpec alias's return type uses it and its ParamSpec slot is not a ParamSpec Bug Report A function whose return type is a generic alias over a ParamSpec, with a parameter list ( The same signature is accepted when:
pyright, pyrefly and ty accept all of them. To Reproduce from collections.abc import Callable from typing import ParamSpec, TypeAlias, TypeVar P = ParamSpec("P") T = TypeVar("T") Alias: TypeAlias = Callable[P, T] NoParamSpec: TypeAlias = Callable[[int], T] def plain() -> Callable[[int], T]: # accepted raise NotImplementedError def no_paramspec_alias() -> NoParamSpec[T]: # accepted raise NotImplementedError def paramspec_alias() -> Alias[[int], T]: # error: Type variable "T" is unbound raise NotImplementedError With PEP 695 syntax: from collections.abc import Callable type Alias[**P, T] = Callable[P, T] def paramspec_alias[T]() -> Alias[[int], T]: # error: Name "T" is not defined raise NotImplementedError def with_paramspec[**Q, T]() -> Alias[Q, T]: # accepted raise NotImplementedError
Expected Behavior No errors: Actual Behavior and, for the PEP 695 example: Where it comes from A decorator-factory alias over a chain type, Your Environment
ActivityMetadataMetadataAssigneesLabelsbugmypy got something wrongmypy got something wrong ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |