calling the default function upon integer overflow in the fallback routine

This commit is contained in:
Pramukta Kumar 2015-03-17 15:05:04 -04:00
parent 2d05b40b03
commit 10cd2d2ebf

View file

@ -655,6 +655,10 @@ class Packer(object):
return self._buffer.write(struct.pack(">BQ", 0xcf, obj))
if -0x8000000000000000 <= obj < -0x80000000:
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")
if self._use_bin_type and isinstance(obj, bytes):
n = len(obj)