@@ -59,19 +59,19 @@ def _encode_builtin(o: object) -> dict[str, Any] | None:
5959def _decode_builtin (info : dict [str , Any ], namespace : dict [str , Any ]) -> Any :
6060 """Reverse :func:`_encode_builtin`."""
6161 kind = info .get ("type" )
62- raw = info .get ("value" )
62+ raw : Any = info .get ("value" )
6363 if kind == "datetime" :
64- return _dt .datetime .fromisoformat (raw )
64+ return _dt .datetime .fromisoformat (str ( raw ) )
6565 if kind == "date" :
66- return _dt .date .fromisoformat (raw )
66+ return _dt .date .fromisoformat (str ( raw ) )
6767 if kind == "time" :
68- return _dt .time .fromisoformat (raw )
68+ return _dt .time .fromisoformat (str ( raw ) )
6969 if kind == "timedelta" :
70- return _dt .timedelta (seconds = raw )
70+ return _dt .timedelta (seconds = float ( raw ) )
7171 if kind == "decimal" :
72- return Decimal (raw )
72+ return Decimal (str ( raw ) )
7373 if kind == "uuid" :
74- return uuid .UUID (hex = raw )
74+ return uuid .UUID (hex = str ( raw ) )
7575 if kind == "complex" :
7676 return complex (raw [0 ], raw [1 ])
7777 if kind == "set" :
@@ -84,9 +84,9 @@ def _decode_builtin(info: dict[str, Any], namespace: dict[str, Any]) -> Any:
8484 # instantiated on this platform.
8585 cls = _PATH_CLASSES .get (info .get ("cls" , "" ), pathlib .PurePath )
8686 try :
87- return cls (raw )
87+ return cls (str ( raw ) )
8888 except (NotImplementedError , TypeError ):
89- return pathlib .PurePath (raw )
89+ return pathlib .PurePath (str ( raw ) )
9090 raise ValueError (f"Unknown builtin sentinel type: { kind !r} " )
9191
9292
0 commit comments