You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The inspect library module getmembers() method breaks
sometimes when it makes a getattr() call that fails. A
simple example is a slot that doesn't have a value:
>>> class X(object): __slots__ = 'foo'
>>> import inspect
>>> inspect.getmembers(x())
Traceback (most recent call last):
File "<pyshell#4>", line 1, in -toplevel-
inspect.getmembers(X())
File "C:\PYTHON23\lib\inspect.py", line 171, in
getmembers
value = getattr(object, key)
AttributeError: foo
>>>
On the PEAK mailing list Phillip Eby suggested wrapping
the gettattr() call in try/except. This seems to work fine.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: