From dad3b3305a95b105b1e66cc7daba83aa02817138 Mon Sep 17 00:00:00 2001 From: Gabe Joseph Date: Wed, 16 Oct 2019 12:40:15 -0600 Subject: [PATCH] In hold_trait_notifications, don't assume `change` is a Bunch 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`. --- traitlets/traitlets.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/traitlets/traitlets.py b/traitlets/traitlets.py index 01048c3c..3fa098ea 100644 --- a/traitlets/traitlets.py +++ b/traitlets/traitlets.py @@ -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 + change = Bunch(change) name = change.name cache[name] = compress(cache.get(name), change)