File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -928,11 +928,19 @@ def quote_docstring(docstr: str) -> str:
928928def json_dumps (obj : object , debug : bool = False ) -> bytes :
929929 if orjson is not None :
930930 if debug :
931- return orjson . dumps ( obj , option = orjson .OPT_INDENT_2 | orjson .OPT_SORT_KEYS ) # type: ignore[no-any-return]
931+ dumps_option = orjson .OPT_INDENT_2 | orjson .OPT_SORT_KEYS
932932 else :
933933 # TODO: If we don't sort keys here, testIncrementalInternalScramble fails
934934 # We should document exactly what is going on there
935- return orjson .dumps (obj , option = orjson .OPT_SORT_KEYS ) # type: ignore[no-any-return]
935+ dumps_option = orjson .OPT_SORT_KEYS
936+
937+ try :
938+ return orjson .dumps (obj , option = dumps_option )
939+ except TypeError as e :
940+ if str (e ) == 'Integer exceeds 64-bit range' :
941+ # use stdlib json below
942+ pass
943+ raise
936944
937945 if debug :
938946 return json .dumps (obj , indent = 2 , sort_keys = True ).encode ("utf-8" )
You can’t perform that action at this time.
0 commit comments