New submission from Gregory P. Smith <g...@krypto.org>:
Python 3.7-3.10a1: ``` >>> List.__name__ Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.8/typing.py", line 760, in __getattr__ raise AttributeError(attr) AttributeError: __name__ >>> type(List) <class 'typing._SpecialGenericAlias'> >>> type(List[int]) <class 'typing._GenericAlias'> ``` Python 3.6: ``` >>> from typing import List >>> List.__name__ 'List' >>> type(List) <class 'typing.GenericMeta'> >>> type(List[int]) <class 'typing.GenericMeta'> ``` Is this lack of common meta attributes intentional? It makes the typing types unusual. We just saw it trip up some code that was expecting everything to have a `__name__` attribute while moving beyond 3.6. Judging by that `__getattr__` implementation it should happen on other common `__` attributes as mentioned in https://docs.python.org/3/library/stdtypes.html?highlight=__name__#special-attributes as well. ---------- components: Library (Lib) messages: 380801 nosy: gregory.p.smith priority: normal severity: normal stage: needs patch status: open title: typing classes do not have __name__ attributes in 3.7+ type: behavior versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42329> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com