Skip to content

Commit

Permalink
Fix _show_traceback in _comm_changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Fleming committed Mar 10, 2024
1 parent 200edee commit 24ad054
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/ipywidgets/ipywidgets/widgets/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,15 @@ def _comm_changed(self, change):
if change['new']:
_instances[change['new'].comm_id] = self

# prevent memory leaks by using a weak reference to the widget.
# prevent memory leaks by using a weak reference to self.
ref = weakref.ref(self)
def _handle_msg(msg):
widget = ref()
if widget:
self_ = ref()
if self_ is not None:
try:
widget._handle_msg(msg)
self_._handle_msg(msg)
except Exception as e:
widget._show_traceback(_handle_msg, e)
self_._show_traceback(self_._handle_msg, e)

change['new'].on_msg(_handle_msg)

Expand Down

0 comments on commit 24ad054

Please sign in to comment.