This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients gvanrossum, kj, levkivskyi, martinitus, rhettinger, serhiy.storchaka
Date 2021-10-25.14:52:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There are two ways to fix the larger issue.

1. Make issubclass(types.GenericAlias, type) returning True, and also make isinstance(typing.List[int], type) returning True and issubclass(typing._GenericAlias, type) returning True, and analyze every place in the interpreter and the stdlib which calls isinstance(..., type) or issubclass(..., type) and ensure that they work with types.GenericAlias and typing._GenericAlias and their instances as well as with ordinary types, fix them and add tests for them. And perhaps do the same for types.UnionType, typing._UnionGenericAlias, typing.TypeVar, typing.NewType, etc, etc.

2. Make isinstance(list[int], type) returning False. It would be nice to ad also tests for the same cases as in option 1, but it is not so urgent, and I expect that in most cases the current behavior which matches the status quo is expected.

I tried to implement option 1, but it is just too much places, so it would take a large amount of time which I do not have right now. First than invest my time in this I want to make sure which option is desirable in long term.

Guido, Ivan, Ken Jin, what would you say?
Date User Action Args
2021-10-25 14:52:36serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, rhettinger, levkivskyi, kj, martinitus
2021-10-25 14:52:36serhiy.storchakasetmessageid: <>
2021-10-25 14:52:36serhiy.storchakalinkissue45438 messages
2021-10-25 14:52:36serhiy.storchakacreate