Content-Length: 285591 | pFad | https://github.com/python/cpython/issues/104328

9D Bad error message when inheriting from Generic multiple times · Issue #104328 · python/cpython · GitHub
Skip to content

Bad error message when inheriting from Generic multiple times #104328

@JelleZijlstra

Description

@JelleZijlstra
>>> from typing import Generic, TypeVar
>>> T = TypeVar("T")
>>> U = TypeVar("U")
>>> class X(Generic[T], Generic[U]): pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jelle/py/cpython/Lib/typing.py", line 1088, in _generic_init_subclass
    raise TypeError(
TypeError: Cannot inherit from Generic[...] multiple types.

Should say "multiple times".

Noticed by @carljm in #103764 (comment).

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/104328

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy