diff options
author | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-11-20 16:58:30 (GMT) |
---|---|---|
committer | Michael Foord <fuzzyman@voidspace.org.uk> | 2010-11-20 16:58:30 (GMT) |
commit | 35184edd3d5748db2a0a5bf0d41ffa04b84a7fa3 (patch) | |
tree | 15bd819957745b851bcabfee50d4a138c17bafec /Lib/inspect.py | |
parent | e516265bbc75e4bb7fc2ab6eaeb7ad3aef86a938 (diff) | |
download | cpython-35184edd3d5748db2a0a5bf0d41ffa04b84a7fa3.zip cpython-35184edd3d5748db2a0a5bf0d41ffa04b84a7fa3.tar.gz cpython-35184edd3d5748db2a0a5bf0d41ffa04b84a7fa3.tar.bz2 |
Issue 9732: __class__ no longer checked on objects by getattr_static
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 2f05829..241cd08 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1080,6 +1080,13 @@ def _check_class(klass, attr): pass return _sentinel +def _is_type(obj): + try: + _static_getmro(obj) + except TypeError: + return False + return True + def getattr_static(obj, attr, default=_sentinel): """Retrieve attributes without triggering dynamic lookup via the @@ -1093,7 +1100,7 @@ def getattr_static(obj, attr, default=_sentinel): documentation for details. """ instance_result = _sentinel - if not isinstance(obj, type): + if not _is_type(obj): instance_result = _check_instance(obj, attr) klass = type(obj) else: |