[issue45664] resolve_bases() and new_class() do not work with type alias of a built-in type
Serhiy Storchaka
report at bugs.python.org
Thu Oct 28 16:38:27 EDT 2021
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
resolve_bases() returns incorrect result:
>>> import types
>>> types.resolve_bases((list[int],))
(list[int],)
Expected (list,).
new_class() fails:
>>> types.new_class('L', (list[int],), {})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython/Lib/types.py", line 77, in new_class
return meta(name, resolved_bases, ns, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GenericAlias expected 2 arguments, got 3
Both work well with typing.List[int].
----------
components: Library (Lib)
messages: 405265
nosy: gvanrossum, kj, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: resolve_bases() and new_class() do not work with type alias of a built-in type
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45664>
_______________________________________
More information about the Python-bugs-list
mailing list