Skip to content

Commit a6628b8

Browse files
authored
Gracefully handle explicit transient=None (#322)
* gracefully handle explicit transient=None re #321 * rephrase
1 parent 62d45a1 commit a6628b8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nbclient/client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,12 @@ def process_message(
11001100
content = msg["content"]
11011101
self.log.debug("content: %s", content)
11021102

1103-
display_id = content.get("transient", {}).get("display_id", None)
1103+
# while it's tempting to go for a more concise
1104+
# display_id = content.get("transient", {}).get("display_id", None)
1105+
# this breaks if transient is explicitly set to None
1106+
transient = content.get("transient")
1107+
display_id = transient.get("display_id") if transient else None
1108+
11041109
if display_id and msg_type in {"execute_result", "display_data", "update_display_data"}:
11051110
self._update_display_id(display_id, msg)
11061111

0 commit comments

Comments
 (0)