mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-22 21:33:17 +00:00
fixed support of python3
This commit is contained in:
parent
48ca2d700d
commit
11a3b1561a
2 changed files with 5 additions and 2 deletions
|
@ -194,7 +194,7 @@ class Unpacker(object):
|
|||
if isinstance(next_bytes, array.array):
|
||||
next_bytes = next_bytes.tostring()
|
||||
elif isinstance(next_bytes, bytearray):
|
||||
next_bytes = str(next_bytes)
|
||||
next_bytes = (bytes if PY3 else str)(next_bytes)
|
||||
assert self._fb_feeding
|
||||
if self._fb_buf_n + len(next_bytes) > self._max_buffer_size:
|
||||
raise BufferFull
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# coding: utf-8
|
||||
|
||||
from msgpack import packb, unpackb
|
||||
import sys
|
||||
|
||||
|
||||
def test_unpack_buffer():
|
||||
|
@ -16,5 +17,7 @@ def test_unpack_bytearray():
|
|||
buf = bytearray(packb(('foo', 'bar')))
|
||||
obj = unpackb(buf, use_list=1)
|
||||
assert [b'foo', b'bar'] == obj
|
||||
assert all(type(s)==str for s in obj)
|
||||
expected_type = bytes if sys.version_info[0] == 3 else str
|
||||
assert all(type(s)==expected_type for s in obj)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue