Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions msgpack/_packer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ cdef class Packer(object):
This is useful when trying to implement accurate serialization
for python types.

:param str unicode_errors:
Error handler for encoding unicode. (default: 'strict')

:param str encoding:
(deprecated) Convert unicode to bytes with this encoding. (default: 'utf-8')
:param str unicode_errors:
(deprecated) Error handler for encoding unicode. (default: 'strict')
"""
cdef msgpack_packer pk
cdef object _default
Expand All @@ -117,8 +118,6 @@ cdef class Packer(object):
bint strict_types=False):
if encoding is not None:
PyErr_WarnEx(PendingDeprecationWarning, "encoding is deprecated.", 1)
if unicode_errors is not None:
PyErr_WarnEx(PendingDeprecationWarning, "unicode_errors is deprecated.", 1)
self.use_float = use_single_float
self.strict_types = strict_types
self.autoreset = autoreset
Expand Down
9 changes: 3 additions & 6 deletions msgpack/_unpacker.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ cdef inline int get_data_from_buffer(object obj,

def unpackb(object packed, object object_hook=None, object list_hook=None,
bint use_list=True, bint raw=True,
encoding=None, unicode_errors="strict",
encoding=None, unicode_errors=None,
object_pairs_hook=None, ext_hook=ExtType,
Py_ssize_t max_str_len=2147483647, # 2**32-1
Py_ssize_t max_bin_len=2147483647,
Expand Down Expand Up @@ -193,7 +193,6 @@ def unpackb(object packed, object object_hook=None, object list_hook=None,
cenc = PyBytes_AsString(encoding)

if unicode_errors is not None:
PyErr_WarnEx(PendingDeprecationWarning, "unicode_errors is deprecated", 1)
if isinstance(unicode_errors, unicode):
unicode_errors = unicode_errors.encode('ascii')
elif not isinstance(unicode_errors, bytes):
Expand Down Expand Up @@ -304,8 +303,7 @@ cdef class Unpacker(object):
If it is None (default), msgpack raw is deserialized to Python bytes.

:param str unicode_errors:
Deprecated. Used for decoding msgpack raw with *encoding*.
(default: `'strict'`)
Error handler used for decoding str type. (default: `'strict'`)


Example of streaming deserialize from file-like object::
Expand Down Expand Up @@ -347,7 +345,7 @@ cdef class Unpacker(object):
def __init__(self, file_like=None, Py_ssize_t read_size=0,
bint use_list=True, bint raw=True,
object object_hook=None, object object_pairs_hook=None, object list_hook=None,
encoding=None, unicode_errors='strict', int max_buffer_size=0,
encoding=None, unicode_errors=None, int max_buffer_size=0,
object ext_hook=ExtType,
Py_ssize_t max_str_len=2147483647, # 2**32-1
Py_ssize_t max_bin_len=2147483647,
Expand Down Expand Up @@ -394,7 +392,6 @@ cdef class Unpacker(object):
cenc = PyBytes_AsString(self.encoding)

if unicode_errors is not None:
PyErr_WarnEx(PendingDeprecationWarning, "unicode_errors is deprecated", 1)
if isinstance(unicode_errors, unicode):
self.unicode_errors = unicode_errors.encode('ascii')
elif isinstance(unicode_errors, bytes):
Expand Down
2 changes: 1 addition & 1 deletion msgpack/unpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static inline int unpack_callback_raw(unpack_user* u, const char* b, const char*
} else if (u->raw) {
py = PyBytes_FromStringAndSize(p, l);
} else {
py = PyUnicode_DecodeUTF8(p, l, NULL);
py = PyUnicode_DecodeUTF8(p, l, u->unicode_errors);
}
if (!py)
return -1;
Expand Down