mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-09 19:30:21 +00:00
corresponding change to cython implementation
This commit is contained in:
parent
10cd2d2ebf
commit
6f02d252e1
1 changed files with 14 additions and 6 deletions
|
|
@ -136,12 +136,20 @@ cdef class Packer(object):
|
|||
elif PyLong_Check(o):
|
||||
# PyInt_Check(long) is True for Python 3.
|
||||
# Sow we should test long before int.
|
||||
if o > 0:
|
||||
ullval = o
|
||||
ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
|
||||
else:
|
||||
llval = o
|
||||
ret = msgpack_pack_long_long(&self.pk, llval)
|
||||
try:
|
||||
if o > 0:
|
||||
ullval = o
|
||||
ret = msgpack_pack_unsigned_long_long(&self.pk, ullval)
|
||||
else:
|
||||
llval = o
|
||||
ret = msgpack_pack_long_long(&self.pk, llval)
|
||||
except OverflowError, oe:
|
||||
if not default_used and self._default is not None:
|
||||
o = self._default(o)
|
||||
default_used = True
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
elif PyInt_Check(o):
|
||||
longval = o
|
||||
ret = msgpack_pack_long(&self.pk, longval)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue