summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 1685bfc..8268be1 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -253,7 +253,10 @@ def getmembers(object, predicate=None):
Optionally, only return members that satisfy a given predicate."""
results = []
for key in dir(object):
- value = getattr(object, key)
+ try:
+ value = getattr(object, key)
+ except AttributeError:
+ continue
if not predicate or predicate(value):
results.append((key, value))
results.sort()