From a031f8294ee0279540bf017056244cc1ba4b2a28 Mon Sep 17 00:00:00 2001 From: vbarda Date: Thu, 12 Dec 2024 11:06:45 -0500 Subject: [PATCH] all lines --- .../langgraph/checkpoint/serde/jsonplus.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py b/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py index 01c89060b..ff5a91f5d 100644 --- a/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py +++ b/libs/checkpoint/langgraph/checkpoint/serde/jsonplus.py @@ -438,28 +438,36 @@ def _msgpack_default(obj: Any) -> Union[str, msgpack.ExtType]: def _msgpack_ext_hook(code: int, data: bytes) -> Any: if code == EXT_CONSTRUCTOR_SINGLE_ARG: try: - tup = msgpack.unpackb(data, ext_hook=_msgpack_ext_hook) + tup = msgpack.unpackb( + data, ext_hook=_msgpack_ext_hook, strict_map_key=False + ) # module, name, arg return getattr(importlib.import_module(tup[0]), tup[1])(tup[2]) except Exception: return elif code == EXT_CONSTRUCTOR_POS_ARGS: try: - tup = msgpack.unpackb(data, ext_hook=_msgpack_ext_hook) + tup = msgpack.unpackb( + data, ext_hook=_msgpack_ext_hook, strict_map_key=False + ) # module, name, args return getattr(importlib.import_module(tup[0]), tup[1])(*tup[2]) except Exception: return elif code == EXT_CONSTRUCTOR_KW_ARGS: try: - tup = msgpack.unpackb(data, ext_hook=_msgpack_ext_hook) + tup = msgpack.unpackb( + data, ext_hook=_msgpack_ext_hook, strict_map_key=False + ) # module, name, args return getattr(importlib.import_module(tup[0]), tup[1])(**tup[2]) except Exception: return elif code == EXT_METHOD_SINGLE_ARG: try: - tup = msgpack.unpackb(data, ext_hook=_msgpack_ext_hook) + tup = msgpack.unpackb( + data, ext_hook=_msgpack_ext_hook, strict_map_key=False + ) # module, name, arg, method return getattr(getattr(importlib.import_module(tup[0]), tup[1]), tup[3])( tup[2]