diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2018-02-23 15:41:21 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-23 15:41:21 +0900 |
commit | ae3a6ba0b04487d7108360d1d504332aed079556 (patch) | |
tree | 16061fe26078d25e7743d672f2c36067397aea7a /msgpack/fallback.py | |
parent | f38c1a3674b7623080cb774b56ede21383bde04a (diff) | |
download | msgpack-python-ae3a6ba0b04487d7108360d1d504332aed079556.tar.gz |
Deprecate implementation module's unpack() (#290)
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r-- | msgpack/fallback.py | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py index e9108d2..c0e5fd6 100644 --- a/msgpack/fallback.py +++ b/msgpack/fallback.py @@ -101,12 +101,9 @@ def _get_data_from_buffer(obj): def unpack(stream, **kwargs): - """ - Unpack an object from `stream`. - - Raises `ExtraData` when `packed` contains extra bytes. - See :class:`Unpacker` for options. - """ + warnings.warn( + "Direct calling implementation's unpack() is deprecated, Use msgpack.unpack() or unpackb() instead.", + PendingDeprecationWarning) data = stream.read() return unpackb(data, **kwargs) @@ -224,11 +221,7 @@ class Unpacker(object): "encoding is deprecated, Use raw=False instead.", PendingDeprecationWarning) - if unicode_errors is not None: - warnings.warn( - "unicode_errors is deprecated.", - PendingDeprecationWarning) - else: + if unicode_errors is None: unicode_errors = 'strict' if file_like is None: @@ -713,7 +706,7 @@ class Packer(object): (deprecated) Convert unicode to bytes with this encoding. (default: 'utf-8') :param str unicode_errors: - (deprecated) Error handler for encoding unicode. (default: 'strict') + Error handler for encoding unicode. (default: 'strict') """ def __init__(self, default=None, encoding=None, unicode_errors=None, use_single_float=False, autoreset=True, use_bin_type=False, @@ -727,10 +720,6 @@ class Packer(object): if unicode_errors is None: unicode_errors = 'strict' - else: - warnings.warn( - "unicode_errors is deprecated.", - PendingDeprecationWarning) self._strict_types = strict_types self._use_float = use_single_float |