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

In hold_trait_notifications, don't assume change is a Bunch #536

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gjoseph92
Copy link

If a change is submitted directly with HasTraits.notify_change, _notify_observers (which handles turning a dict to a Bunch) has been replaced with hold, which needs to be prepared for plain dicts.

If a change is submitted directly with `HasTraits.notify_change`, `_notify_observers` (which handles turning a `dict` to a `Bunch`) has been replaced with `hold`, which needs to be prepared for plain `dicts`.
Copy link
Contributor

@rmorshea rmorshea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just add a test for this, and I think we can get it in.

@@ -1164,6 +1164,9 @@ def compress(past_changes, change):
return past_changes

def hold(change):
if not isinstance(change, Bunch):
# cast to bunch if given a dict
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry to nitpick. Can you just tab in this comment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants