Skip to content

Commit 97a6eb8

Browse files
committed
replace inspect.isfunction with isinstance(descr, FunctionType)
1 parent da5dc81 commit 97a6eb8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def lookup_special_method(obj, attr, /):
114114
returns the result of the descriptor's `__get__` method. Returns `None`
115115
if the method is not found.
116116
"""
117-
from inspect import getattr_static, isfunction
117+
from inspect import getattr_static
118118
cls = type(obj)
119119
if not isinstance(attr, str):
120120
raise TypeError(
@@ -125,8 +125,8 @@ def lookup_special_method(obj, attr, /):
125125
except AttributeError:
126126
return None
127127
if hasattr(descr, "__get__"):
128-
if isfunction(descr) or isinstance(descr,(
129-
MethodDescriptorType, WrapperDescriptorType)):
128+
if isinstance(descr, (
129+
FunctionType, MethodDescriptorType, WrapperDescriptorType)):
130130
# do not create bound method to mimic the behavior of
131131
# _PyObject_LookupSpecialMethod
132132
return descr

0 commit comments

Comments
 (0)