summaryrefslogtreecommitdiff
path: root/msgpack/fallback.py
diff options
context:
space:
mode:
authorPramukta Kumar <pramukta.kumar@gmail.com>2015-03-17 15:05:04 -0400
committerPramukta Kumar <pramukta.kumar@gmail.com>2015-03-17 15:05:04 -0400
commit10cd2d2ebf6390e844c2bf59e9efd765f9b60e40 (patch)
tree8184ce8cdd6e0639e5c66c5b8b4a7cc5b3204cb3 /msgpack/fallback.py
parent2d05b40b030cb6b5da0913e72b59a91b09faccab (diff)
downloadmsgpack-python-10cd2d2ebf6390e844c2bf59e9efd765f9b60e40.tar.gz
calling the default function upon integer overflow in the fallback routine
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r--msgpack/fallback.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py
index 235c201..eb20002 100644
--- a/msgpack/fallback.py
+++ b/msgpack/fallback.py
@@ -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)