Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplify method dispatch
  • Loading branch information
johnslavik committed Feb 16, 2026
commit 4c1cfd7047a09d1cb1e998b6eb9ebb3a793f1385
6 changes: 2 additions & 4 deletions Lib/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,10 +1093,8 @@ def __call__(self, /, *args, **kwargs):
'singledispatchmethod method')
raise TypeError(f'{funcname} requires at least '
'1 positional argument')
if self._skip_bound_arg:
method = self._dispatch(args[1].__class__)
else:
method = self._dispatch(args[0].__class__)
index = 1 if self._skip_bound_arg else 0
method = self._dispatch(args[index].__class__)

if hasattr(method, "__get__"):
# If the method is a descriptor, it might be necessary
Expand Down
Loading