mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-25 14:44:10 +00:00
calling the default function upon integer overflow in the fallback routine
This commit is contained in:
parent
2d05b40b03
commit
10cd2d2ebf
1 changed files with 4 additions and 0 deletions
|
|
@ -655,6 +655,10 @@ class Packer(object):
|
||||||
return self._buffer.write(struct.pack(">BQ", 0xcf, obj))
|
return self._buffer.write(struct.pack(">BQ", 0xcf, obj))
|
||||||
if -0x8000000000000000 <= obj < -0x80000000:
|
if -0x8000000000000000 <= obj < -0x80000000:
|
||||||
return self._buffer.write(struct.pack(">Bq", 0xd3, obj))
|
return self._buffer.write(struct.pack(">Bq", 0xd3, obj))
|
||||||
|
if not default_used and self._default is not None:
|
||||||
|
obj = self._default(obj)
|
||||||
|
default_used = True
|
||||||
|
continue
|
||||||
raise PackValueError("Integer value out of range")
|
raise PackValueError("Integer value out of range")
|
||||||
if self._use_bin_type and isinstance(obj, bytes):
|
if self._use_bin_type and isinstance(obj, bytes):
|
||||||
n = len(obj)
|
n = len(obj)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue