Ken Jin <kenjin4...@gmail.com> added the comment:
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? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45755> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com