summaryrefslogtreecommitdiff
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2019-09-05 13:07:08 +0900
committerGitHub <noreply@github.com>2019-09-05 13:07:08 +0900
commit8f9cc8771ffb8d0e21be287eaed42ae06087acca (patch)
treea787ec3d18b375519f6812e6d4632cc18800828f /Lib/inspect.py
parent2cd902585815582eb059e3b40e014ebe4e7fdee7 (diff)
downloadcpython-git-8f9cc8771ffb8d0e21be287eaed42ae06087acca.tar.gz
bpo-38026: fix inspect.getattr_static (GH-15676)
It should avoid dynamic lookup including `isinstance`. This is a regression caused by GH-5351.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 99a580bd2f..a616f2d49b 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1558,7 +1558,7 @@ def _shadowed_dict(klass):
except KeyError:
pass
else:
- if not (isinstance(class_dict, types.GetSetDescriptorType) and
+ if not (type(class_dict) is types.GetSetDescriptorType and
class_dict.__name__ == "__dict__" and
class_dict.__objclass__ is entry):
return class_dict
@@ -1580,7 +1580,7 @@ def getattr_static(obj, attr, default=_sentinel):
klass = type(obj)
dict_attr = _shadowed_dict(klass)
if (dict_attr is _sentinel or
- isinstance(dict_attr, types.MemberDescriptorType)):
+ type(dict_attr) is types.MemberDescriptorType):
instance_result = _check_instance(obj, attr)
else:
klass = obj