Skip to content

Commit 10cd2d2

Browse files
committed
calling the default function upon integer overflow in the fallback routine
1 parent 2d05b40 commit 10cd2d2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

msgpack/fallback.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ def _pack(self, obj, nest_limit=DEFAULT_RECURSE_LIMIT, isinstance=isinstance):
655655
return self._buffer.write(struct.pack(">BQ", 0xcf, obj))
656656
if -0x8000000000000000 <= obj < -0x80000000:
657657
return self._buffer.write(struct.pack(">Bq", 0xd3, obj))
658+
if not default_used and self._default is not None:
659+
obj = self._default(obj)
660+
default_used = True
661+
continue
658662
raise PackValueError("Integer value out of range")
659663
if self._use_bin_type and isinstance(obj, bytes):
660664
n = len(obj)

0 commit comments

Comments
 (0)