Message404967
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:36 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, rhettinger, levkivskyi, kj, martinitus |
2021-10-25 14:52:36 | serhiy.storchaka | set | messageid: <1635173556.2.0.499122146008.issue45438@roundup.psfhosted.org> |
2021-10-25 14:52:36 | serhiy.storchaka | link | issue45438 messages |
2021-10-25 14:52:36 | serhiy.storchaka | create | |
|