[New-bugs-announce] [issue42740] typing.py get_args and get_origin should support PEP 604 and 612
Ken Jin
report at bugs.python.org
Fri Dec 25 10:19:22 EST 2020
New submission from Ken Jin <kenjin4096 at gmail.com>:
Currently get_args doesn't work for PEP 604 Union:
>>> get_args(int | str)
or new Callables with PEP 612:
>>> P = ParamSpec('P)
>>> get_args(Callable[P, int])
([~P], <class 'int'>)
get_origin doesn't work with PEP 604 Unions:
>>> get_origin(int | str)
PS: the fix has to be backported partly to 3.9. Because get_args doesn't handle collections.abc.Callable either.
----------
components: Library (Lib)
messages: 383747
nosy: gvanrossum, kj, levkivskyi
priority: normal
severity: normal
status: open
title: typing.py get_args and get_origin should support PEP 604 and 612
type: behavior
versions: Python 3.10, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42740>
_______________________________________
More information about the New-bugs-announce
mailing list