File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ def feed(self, next_bytes):
194
194
if isinstance (next_bytes , array .array ):
195
195
next_bytes = next_bytes .tostring ()
196
196
elif isinstance (next_bytes , bytearray ):
197
- next_bytes = str (next_bytes )
197
+ next_bytes = ( bytes if PY3 else str ) (next_bytes )
198
198
assert self ._fb_feeding
199
199
if self ._fb_buf_n + len (next_bytes ) > self ._max_buffer_size :
200
200
raise BufferFull
Original file line number Diff line number Diff line change 2
2
# coding: utf-8
3
3
4
4
from msgpack import packb , unpackb
5
+ import sys
5
6
6
7
7
8
def test_unpack_buffer ():
@@ -16,5 +17,7 @@ def test_unpack_bytearray():
16
17
buf = bytearray (packb (('foo' , 'bar' )))
17
18
obj = unpackb (buf , use_list = 1 )
18
19
assert [b'foo' , b'bar' ] == obj
19
- assert all (type (s )== str for s in obj )
20
+ expected_type = bytes if sys .version_info [0 ] == 3 else str
21
+ assert all (type (s )== expected_type for s in obj )
22
+
20
23
You can’t perform that action at this time.
0 commit comments