8000 Apply get_args fix from bpo-40398 to typing_extensions (#770) · python/typing@b5c0b6d · GitHub
[go: up one dir, main page]

Skip to content

Commit b5c0b6d

Browse files
authored
Apply get_args fix from bpo-40398 to typing_extensions (#770)
Applies the fix from https://bugs.python.org/issue40398 to typing_extensions: typ 8000 ing.get_args() now always returns an empty tuple for special generic aliases.
1 parent 27147f8 commit b5c0b6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

typing_extensions/src_py3/typing_extensions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,7 @@ def get_args(tp):
20652065
"""
20662066
if isinstance(tp, _AnnotatedAlias):
20672067
return (tp.__origin__,) + tp.__metadata__
2068-
if isinstance(tp, _GenericAlias):
2068+
if isinstance(tp, _GenericAlias) and not tp._special:
20692069
res = tp.__args__
20702070
if get_origin(tp) is collections.abc.Callable and res[0] is not Ellipsis:
20712071
res = (list(res[:-1]), res[-1])

0 commit comments

Comments
 (0)
0