From 041ceaa1fbbcb456aea8050f57ae1ab6acb96587 Mon Sep 17 00:00:00 2001 From: bswck Date: Fri, 17 Oct 2025 16:20:18 +0200 Subject: [PATCH] Change function name and add docs --- Lib/functools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/functools.py b/Lib/functools.py index 218185c03a2..0f2b5b23d9f 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -935,7 +935,8 @@ def _is_valid_dispatch_type(cls): return (isinstance(cls, UnionType) and all(isinstance(arg, type) for arg in cls.__args__)) - def _get_type_hints(func): + def _get_func_type_hints(func): + """Called when type hints are needed to choose the first argument to dispatch on.""" ann = getattr(func, '__annotate__', None) if ann is None: raise TypeError( @@ -977,7 +978,7 @@ def register(cls, func=None): f"{cls!r} is not a class or union type." ) func = cls - type_hints = _get_type_hints(func) + type_hints = _get_func_type_hints(func) argname, cls = next(iter(type_hints.items()))