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

Skip to content
Merged
Show file tree
Hide file tree
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
Add correct GitHub references
  • Loading branch information
johnslavik committed Feb 9, 2026
commit ab7d78cee78c52827b841c62c030bbbfb0f217ac
4 changes: 3 additions & 1 deletion Lib/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,12 +1060,14 @@ def __init__(self, unbound, obj, cls):
# Set instance attributes which cannot be handled in __getattr__()
# because they conflict with type descriptors.
func = unbound.func

# Dispatch on the second argument if a generic method turns into
# a bound method on instance-level access.
# a bound method on instance-level access. See GH-143535.
if obj is None and isinstance(func, FunctionType):
self._skip_bound_arg = True
else:
self._skip_bound_arg = False

try:
self.__module__ = func.__module__
except AttributeError:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3006,7 +3006,7 @@ def static_func(arg: int) -> str:
self.assertEqual(A().static_func.__name__, 'static_func')

def test_method_classlevel_calls(self):
"""Regression test for GH-144615."""
"""Regression test for GH-143535."""
Comment thread
johnslavik marked this conversation as resolved.
class C:
@functools.singledispatchmethod
def generic(self, x: object):
Expand Down
Loading