Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
Below is a simplification of some classes that create the problem:
importtypingK=typing.TypeVar("K")V=typing.TypeVar("V")classBaseMap(typing.Mapping[K,V]): ...classMutableMap(BaseMap[K,V],typing.MutableMapping[K,V]): ...classMyMap(typing.Dict[K,V],MutableMap[K,V]): ...
Just entering these definitions in the REPL causes the error.
The stack trace (with info about variableb):
b=__main__.MutableMap[~V]type(b)=<class 'types.GenericAlias'>Traceback (most recent call last): File "<stdin>", line 1, in <module> class MyMap(typing.Dict[K, V], MutableMap[V]): ... File "/home/russell/.pyenv/versions/3.13-dev/lib/python3.13/typing.py", line 1391, in __mro_entries__ return super().__mro_entries__(bases) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^ File "/home/russell/.pyenv/versions/3.13-dev/lib/python3.13/typing.py", line 1143, in __mro_entries__ if isinstance(b, _BaseGenericAlias) or issubclass(b, Generic): ~~~~~~~~~~^^^^^^^^^^^^TypeError: issubclass() arg 1 must be a classThis works "fine" before Python 3.13. If I swap the order oftyping.Dict[K, V], MutableMap[V], the error no longer presents on 3.13.
I don't understand enough of intersection of these topics to know if this is now an expected error or something is considered wrong. This does seem related to#103369.
CPython versions tested on:
3.8, 3.9, 3.10, 3.11, 3.12, 3.13, CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done