Skip to content

Commit

Permalink
fix: some descriptors raise AttributeError (#812)
Browse files Browse the repository at this point in the history
Regression, noticed in #777 (comment)
  • Loading branch information
maartenbreddels committed Dec 12, 2022
1 parent 11ea470 commit aa0d38b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion traitlets/traitlets.py
Expand Up @@ -1006,7 +1006,13 @@ def setup_class(cls, classdict): # noqa
mro = cls.mro()

for name in dir(cls):
value = getattr(cls, name)
# Some descriptors raise AttributeError like zope.interface's
# __provides__ attributes even though they exist. This causes
# AttributeErrors even though they are listed in dir(cls).
try:
value = getattr(cls, name)
except AttributeError:
continue
if isinstance(value, TraitType):
cls._traits[name] = value
trait = value
Expand Down

0 comments on commit aa0d38b

Please sign in to comment.