Skip to content

Commit

Permalink
gracefully handle explicit transient=None re jupyter#321
Browse files Browse the repository at this point in the history
  • Loading branch information
callmephilip committed Dec 13, 2024
1 parent 62d45a1 commit 031be42
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nbclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,12 @@ def process_message(
content = msg["content"]
self.log.debug("content: %s", content)

display_id = content.get("transient", {}).get("display_id", None)
# while it's tempting to go for a more concise
# display_id = content.get("transient", {}).get("display_id", None)
# this breaks if transient is explicitly set to None
transient = content.get("transient", {})
display_id = transient.get("display_id", None) if transient else None

if display_id and msg_type in {"execute_result", "display_data", "update_display_data"}:
self._update_display_id(display_id, msg)

Expand Down

0 comments on commit 031be42

Please sign in to comment.