Skip to content

Commit

Permalink
bpo-38026: fix inspect.getattr_static
Browse files Browse the repository at this point in the history
It should avoid dynamic lookup including `isinstance`.

This is regression caused by pythonGH-5351.
  • Loading branch information
methane committed Sep 4, 2019
1 parent 675d17c commit 1dc1cd0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1dc1cd0

Please sign in to comment.