-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed as not planned
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Setting a generic type with a type specification [] to isinstance() and issubclass() gets the wrong error messages as shown below:
*Notes:
- Python 3.15.0a6
x = 100
isinstance(x, tuple) # No error
isinstance(x, tuple[int, str]) # ErrorTypeError: isinstance() argument 2 cannot be a parameterized generic
class Cls: ...
issubclass(Cls, tuple) # No error
issubclass(Cls, tuple[int, str]) # ErrorTypeError: issubclass() argument 2 cannot be a parameterized generic
Actually, saying "parameterized" reminds function parameters so "argumentized" should be used and "type" should also be used after "generic" as shown below:
*Notes:
- "argumentized" isn't common but intuitive.
TypeError: isinstance() argument 2 cannot be an argumentized generic type
TypeError: issubclass() argument 2 cannot be an argumentized generic type
parameterized
argumentized
CPython versions tested on:
3.15
Operating systems tested on:
Windows
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error