@@ -43,7 +43,7 @@ from msgpack import ExtType
4343cdef extern from " unpack.h" :
4444 ctypedef struct msgpack_user:
4545 bint use_list
46- bint raw_as_bytes
46+ bint raw
4747 bint has_pairs_hook # call object_hook with k-v pairs
4848 PyObject* object_hook
4949 PyObject* list_hook
@@ -74,14 +74,14 @@ cdef extern from "unpack.h":
7474cdef inline init_ctx(unpack_context * ctx,
7575 object object_hook, object object_pairs_hook,
7676 object list_hook, object ext_hook,
77- bint use_list, bint raw_as_bytes ,
77+ bint use_list, bint raw ,
7878 char * encoding, char * unicode_errors,
7979 Py_ssize_t max_str_len, Py_ssize_t max_bin_len,
8080 Py_ssize_t max_array_len, Py_ssize_t max_map_len,
8181 Py_ssize_t max_ext_len):
8282 unpack_init(ctx)
8383 ctx.user.use_list = use_list
84- ctx.user.raw_as_bytes = raw_as_bytes
84+ ctx.user.raw = raw
8585 ctx.user.object_hook = ctx.user.list_hook = < PyObject* > NULL
8686 ctx.user.max_str_len = max_str_len
8787 ctx.user.max_bin_len = max_bin_len
@@ -158,7 +158,7 @@ cdef inline int get_data_from_buffer(object obj,
158158 return 1
159159
160160def unpackb (object packed , object object_hook = None , object list_hook = None ,
161- bint use_list = True , bint raw_as_bytes = True ,
161+ bint use_list = True , bint raw = True ,
162162 encoding = None , unicode_errors = " strict" ,
163163 object_pairs_hook = None , ext_hook = ExtType,
164164 Py_ssize_t max_str_len = 2147483647 , # 2**32-1
@@ -185,7 +185,7 @@ def unpackb(object packed, object object_hook=None, object list_hook=None,
185185 cdef int new_protocol = 0
186186
187187 if encoding is not None :
188- PyErr_WarnEx(PendingDeprecationWarning , " encoding is deprecated, Use raw_as_bytes =False instead." , 1 )
188+ PyErr_WarnEx(PendingDeprecationWarning , " encoding is deprecated, Use raw =False instead." , 1 )
189189 if isinstance (encoding, unicode ):
190190 encoding = encoding.encode(' ascii' )
191191 elif not isinstance (encoding, bytes):
@@ -203,7 +203,7 @@ def unpackb(object packed, object object_hook=None, object list_hook=None,
203203 get_data_from_buffer(packed, & view, & buf, & buf_len, & new_protocol)
204204 try :
205205 init_ctx(& ctx, object_hook, object_pairs_hook, list_hook, ext_hook,
206- use_list, raw_as_bytes , cenc, cerr,
206+ use_list, raw , cenc, cerr,
207207 max_str_len, max_bin_len, max_array_len, max_map_len, max_ext_len)
208208 ret = unpack_construct(& ctx, buf, buf_len, & off)
209209 finally :
@@ -261,7 +261,7 @@ cdef class Unpacker(object):
261261 If true, unpack msgpack array to Python list.
262262 Otherwise, unpack to Python tuple. (default: True)
263263
264- :param bool raw_as_bytes :
264+ :param bool raw :
265265 If true, unpack msgpack raw to Python bytes (default).
266266 Otherwise, unpack to Python str (or unicode on Python 2) by decoding
267267 with UTF-8 encoding (recommended).
@@ -299,7 +299,7 @@ cdef class Unpacker(object):
299299 Limits max length of map. (default: 2**31-1)
300300
301301 :param str encoding:
302- Deprecated, use raw_as_bytes instead.
302+ Deprecated, use raw instead.
303303 Encoding used for decoding msgpack raw.
304304 If it is None (default), msgpack raw is deserialized to Python bytes.
305305
@@ -310,13 +310,13 @@ cdef class Unpacker(object):
310310
311311 Example of streaming deserialize from file-like object::
312312
313- unpacker = Unpacker(file_like, raw_as_bytes =False)
313+ unpacker = Unpacker(file_like, raw =False)
314314 for o in unpacker:
315315 process(o)
316316
317317 Example of streaming deserialize from socket::
318318
319- unpacker = Unpacker(raw_as_bytes =False)
319+ unpacker = Unpacker(raw =False)
320320 while True:
321321 buf = sock.recv(1024**2)
322322 if not buf:
@@ -345,7 +345,7 @@ cdef class Unpacker(object):
345345 self .buf = NULL
346346
347347 def __init__ (self , file_like = None , Py_ssize_t read_size = 0 ,
348- bint use_list = True , bint raw_as_bytes = True ,
348+ bint use_list = True , bint raw = True ,
349349 object object_hook = None , object object_pairs_hook = None , object list_hook = None ,
350350 encoding = None , unicode_errors = ' strict' , int max_buffer_size = 0 ,
351351 object ext_hook = ExtType,
@@ -384,7 +384,7 @@ cdef class Unpacker(object):
384384 self .stream_offset = 0
385385
386386 if encoding is not None :
387- PyErr_WarnEx(PendingDeprecationWarning , " encoding is deprecated, Use raw_as_bytes =False instead." , 1 )
387+ PyErr_WarnEx(PendingDeprecationWarning , " encoding is deprecated, Use raw =False instead." , 1 )
388388 if isinstance (encoding, unicode ):
389389 self .encoding = encoding.encode(' ascii' )
390390 elif isinstance (encoding, bytes):
@@ -404,7 +404,7 @@ cdef class Unpacker(object):
404404 cerr = PyBytes_AsString(self .unicode_errors)
405405
406406 init_ctx(& self .ctx, object_hook, object_pairs_hook, list_hook,
407- ext_hook, use_list, raw_as_bytes , cenc, cerr,
407+ ext_hook, use_list, raw , cenc, cerr,
408408 max_str_len, max_bin_len, max_array_len,
409409 max_map_len, max_ext_len)
410410
0 commit comments