summaryrefslogtreecommitdiff
path: root/msgpack/fallback.py
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2015-11-09 02:23:22 +0900
committerINADA Naoki <methane@users.noreply.github.com>2015-11-09 02:23:22 +0900
commitca87a7e539e0bd1b69ce8e715b1fd6ecab5f5553 (patch)
tree4c0bd9cc6e798eb715ef50ab7fc3d4f90f849f9d /msgpack/fallback.py
parent7d900371c8f13fa64f06aaf336b6ae65c705bf2c (diff)
parent6f02d252e1dc66d67861b45c5bead8392ed822d4 (diff)
downloadmsgpack-python-ca87a7e539e0bd1b69ce8e715b1fd6ecab5f5553.tar.gz
Merge pull request #135 from pramukta/default_function_on_int_overflow
Default function on int overflow
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)