From def9a74356a2acebf9fcbf8faed8eb33cfa3a150 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Mon, 7 Mar 2022 11:39:50 +0100 Subject: [PATCH] Json packer: handle TypeError and fallback to old json_clean --- jupyter_client/session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter_client/session.py b/jupyter_client/session.py index f21a34a84..e56b4f861 100644 --- a/jupyter_client/session.py +++ b/jupyter_client/session.py @@ -100,7 +100,7 @@ def json_packer(obj): ensure_ascii=False, allow_nan=False, ).encode("utf8") - except ValueError as e: + except (TypeError, ValueError) as e: # Fallback to trying to clean the json before serializing packed = json.dumps( json_clean(obj),