Skip to content

Commit d282c9a

Browse files
committed
Use __role__ name only in the register() signature
1 parent 9977251 commit d282c9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/functools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ def _find_impl(cls, registry):
888888
match = t
889889
return registry.get(match)
890890

891-
def _get_singledispatch_annotated_param(func, *, __role__):
891+
def _get_singledispatch_annotated_param(func, *, role):
892892
"""Find the first positional and user-specified parameter in a callable
893893
or descriptor.
894894
@@ -902,7 +902,7 @@ def _get_singledispatch_annotated_param(func, *, __role__):
902902
func = func.__func__
903903
else:
904904
# Skip *self* when called from `singledispatchmethod.register`.
905-
idx = 0 if __role__ == "function" else 1
905+
idx = 0 if role == "function" else 1
906906
# Fast path: emulate `inspect._signature_from_function` if possible.
907907
if isinstance(func, FunctionType) and not hasattr(func, "__wrapped__"):
908908
func_code = func.__code__
@@ -998,7 +998,7 @@ def register(cls, func=None, __role__="function"):
998998
)
999999
func = cls
10001000

1001-
argname = _get_singledispatch_annotated_param(func, __role__=__role__)
1001+
argname = _get_singledispatch_annotated_param(func, role=__role__)
10021002

10031003
# only import typing if annotation parsing is necessary
10041004
from typing import get_type_hints

0 commit comments

Comments
 (0)