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 kj
Recipients gvanrossum, kj, kjamieson, xtreak
Date 2021-12-06.16:45:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638809157.51.0.931703893001.issue45755@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2021-12-06 16:45:57kjsetrecipients: + kj, gvanrossum, xtreak, kjamieson
2021-12-06 16:45:57kjsetmessageid: <1638809157.51.0.931703893001.issue45755@roundup.psfhosted.org>
2021-12-06 16:45:57kjlinkissue45755 messages
2021-12-06 16:45:57kjcreate