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):
194194 if isinstance (next_bytes , array .array ):
195195 next_bytes = next_bytes .tostring ()
196196 elif isinstance (next_bytes , bytearray ):
197- next_bytes = str (next_bytes )
197+ next_bytes = ( bytes if PY3 else str ) (next_bytes )
198198 assert self ._fb_feeding
199199 if self ._fb_buf_n + len (next_bytes ) > self ._max_buffer_size :
200200 raise BufferFull
Original file line number Diff line number Diff line change 22# coding: utf-8
33
44from msgpack import packb , unpackb
5+ import sys
56
67
78def test_unpack_buffer ():
@@ -16,5 +17,7 @@ def test_unpack_bytearray():
1617 buf = bytearray (packb (('foo' , 'bar' )))
1718 obj = unpackb (buf , use_list = 1 )
1819 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+
2023
You can’t perform that action at this time.
0 commit comments