Skip to content

Commit aa0d38b

Browse files
fix: some descriptors raise AttributeError (#812)
Regression, noticed in #777 (comment)
1 parent 11ea470 commit aa0d38b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

traitlets/traitlets.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,13 @@ def setup_class(cls, classdict): # noqa
10061006
mro = cls.mro()
10071007

10081008
for name in dir(cls):
1009-
value = getattr(cls, name)
1009+
# Some descriptors raise AttributeError like zope.interface's
1010+
# __provides__ attributes even though they exist. This causes
1011+
# AttributeErrors even though they are listed in dir(cls).
1012+
try:
1013+
value = getattr(cls, name)
1014+
except AttributeError:
1015+
continue
10101016
if isinstance(value, TraitType):
10111017
cls._traits[name] = value
10121018
trait = value

0 commit comments

Comments
 (0)