diff options
author | Inada Naoki <songofacandy@gmail.com> | 2019-12-03 18:54:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-03 18:54:01 +0900 |
commit | e1ed0044bf31dc0d6ef951f6298de4f420170968 (patch) | |
tree | e12172aafa58a61cf555ed20a5d5ac7f9aa22dfc /msgpack/fallback.py | |
parent | cc3a8665d6210e933bcfb9120bd0ceb15224f03e (diff) | |
download | msgpack-python-e1ed0044bf31dc0d6ef951f6298de4f420170968.tar.gz |
Remove encoding/unicode_errors options from Packer (#378)
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r-- | msgpack/fallback.py | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py index 1ed6e77..5dab906 100644 --- a/msgpack/fallback.py +++ b/msgpack/fallback.py @@ -752,32 +752,14 @@ class Packer(object): Additionally tuples will not be serialized as lists. This is useful when trying to implement accurate serialization for python types. - - :param str encoding: - (deprecated) Convert unicode to bytes with this encoding. (default: 'utf-8') - - :param str unicode_errors: - Error handler for encoding unicode. (default: 'strict') """ - def __init__(self, default=None, encoding=None, unicode_errors=None, + def __init__(self, default=None, use_single_float=False, autoreset=True, use_bin_type=False, strict_types=False): - if encoding is None: - encoding = 'utf_8' - else: - warnings.warn( - "encoding is deprecated, Use raw=False instead.", - DeprecationWarning, stacklevel=2) - - if unicode_errors is None: - unicode_errors = 'strict' - self._strict_types = strict_types self._use_float = use_single_float self._autoreset = autoreset self._use_bin_type = use_bin_type - self._encoding = encoding - self._unicode_errors = unicode_errors self._buffer = StringIO() if default is not None: if not callable(default): @@ -834,11 +816,7 @@ class Packer(object): self._pack_bin_header(n) return self._buffer.write(obj) if check(obj, unicode): - if self._encoding is None: - raise TypeError( - "Can't encode unicode string: " - "no encoding is specified") - obj = obj.encode(self._encoding, self._unicode_errors) + obj = obj.encode("utf-8") n = len(obj) if n >= 2**32: raise ValueError("String is too large") |