Skip to content

Commit 2d1180a

Browse files
committed
Make the private helper tighter
1 parent 946ccb8 commit 2d1180a

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

Lib/functools.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,6 @@ def _get_singledispatch_annotated_param(func, *, __role__):
902902
func = func.__func__
903903
else:
904904
idx = 0 if __role__ == "function" else 1
905-
906905
# If it is a simple function, try to read from the code object fast.
907906
if isinstance(func, FunctionType) and not hasattr(func, "__wrapped__"):
908907
# Emulate inspect._signature_from_function to get the desired parameter.
@@ -911,7 +910,6 @@ def _get_singledispatch_annotated_param(func, *, __role__):
911910
return func_code.co_varnames[:func_code.co_argcount][idx]
912911
except IndexError:
913912
pass
914-
915913
# Fall back to inspect.signature (slower, but complete).
916914
import inspect
917915
params = list(inspect.signature(func).parameters.values())
@@ -923,7 +921,6 @@ def _get_singledispatch_annotated_param(func, *, __role__):
923921
# Allow variadic positional "(*args)" parameters for backward compatibility.
924922
if param.kind not in (inspect.Parameter.KEYWORD_ONLY, inspect.Parameter.VAR_KEYWORD):
925923
return param.name
926-
927924
raise TypeError(
928925
f"Invalid first argument to `register()`: {func!r} "
929926
f"does not accept positional arguments."

0 commit comments

Comments
 (0)