Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Certain multiple inheritance using generic alias errors in 3.13 #112903

Closed
Assignees
sobolevn
Labels
3.13bugs and security fixesrelease-blockerstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error
@rmartin16

Description

@rmartin16

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 class

This 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

3.13bugs and security fixesrelease-blockerstdlibStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp