Message407838
Not exactly sure if this is a bug, but the reason is that Foo[int] used to be a class, now it's a plain object. It's a change brought in 3.7 by PEP 560.
3.6:
>>> isinstance(Foo[int], type)
True
>>> Foo[int].__dir__
<method '__dir__' of 'object' objects
>>> type(Foo[int].__dir__)
<class 'method_descriptor'>
main:
>>> isinstance(Foo[int], type)
False
>>> Foo[int].__dir__
<built-in method __dir__ of _GenericAlias object at 0x000001B44DF0A850>
>>> type(Foo[int].__dir__)
<class 'method_descriptor'>
The fix is just a 2-line change in either _GenericAlias or _BaseGenericAlias:
+ def __dir__(self):
+ return dir(self.__origin__)
Should we go ahead with this? |
|
Date |
User |
Action |
Args |
2021-12-06 16:45:57 | kj | set | recipients:
+ kj, gvanrossum, xtreak, kjamieson |
2021-12-06 16:45:57 | kj | set | messageid: <1638809157.51.0.931703893001.issue45755@roundup.psfhosted.org> |
2021-12-06 16:45:57 | kj | link | issue45755 messages |
2021-12-06 16:45:57 | kj | create | |
|