Skip to content

Commit 856f612

Browse files
committed
Add fix -- second-pass for lstrip to not slow down the rewrite function
1 parent b866a1c commit 856f612

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/annotationlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ def _rewrite_star_unpack(arg):
10961096
"""If the given argument annotation expression is a star unpack e.g. `'*Ts'`
10971097
rewrite it to a valid expression.
10981098
"""
1099-
if arg.startswith("*"):
1099+
if arg.lstrip().startswith("*"):
11001100
return f"({arg},)[0]" # E.g. (*Ts,)[0] or (*tuple[int, int],)[0]
11011101
else:
11021102
return arg

0 commit comments

Comments
 (0)