#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
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 @@
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()