Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: some descriptors raise AttributeError #812

Merged
merged 1 commit into from Dec 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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