diff options
author | Michael Foord <michael@voidspace.org.uk> | 2011-12-18 22:09:27 (GMT) |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2011-12-18 22:09:27 (GMT) |
commit | a699a2d0c1a59aeaea47f50701c40a1cff18e4b6 (patch) | |
tree | 7acfe65f5a9da8efd6cd8b9b73b17a3c090fd953 /Lib/inspect.py | |
parent | 8f23be7189833ac0852cb5b0375241fbf7c48094 (diff) | |
parent | a51623b1602d6bb695fee36e74146269e6358d6b (diff) | |
download | cpython-a699a2d0c1a59aeaea47f50701c40a1cff18e4b6.zip cpython-a699a2d0c1a59aeaea47f50701c40a1cff18e4b6.tar.gz cpython-a699a2d0c1a59aeaea47f50701c40a1cff18e4b6.tar.bz2 |
Merge 3.2
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index c0b67a3..5a22076 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1109,7 +1109,7 @@ def _check_instance(obj, attr): def _check_class(klass, attr): for entry in _static_getmro(klass): - if not _shadowed_dict(type(entry)): + if _shadowed_dict(type(entry)) is _sentinel: try: return entry.__dict__[attr] except KeyError: @@ -1134,8 +1134,8 @@ def _shadowed_dict(klass): if not (type(class_dict) is types.GetSetDescriptorType and class_dict.__name__ == "__dict__" and class_dict.__objclass__ is entry): - return True - return False + return class_dict + return _sentinel def getattr_static(obj, attr, default=_sentinel): """Retrieve attributes without triggering dynamic lookup via the @@ -1151,7 +1151,9 @@ def getattr_static(obj, attr, default=_sentinel): instance_result = _sentinel if not _is_type(obj): klass = type(obj) - if not _shadowed_dict(klass): + dict_attr = _shadowed_dict(klass) + if (dict_attr is _sentinel or + type(dict_attr) is types.MemberDescriptorType): instance_result = _check_instance(obj, attr) else: klass = obj |