diff options
author | INADA Naoki <methane@users.noreply.github.com> | 2018-11-14 16:34:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-14 16:34:51 +0900 |
commit | 2b5f59166beeccde0ee230c8673cf50932c8daba (patch) | |
tree | f2c9d9cad2ed2cc7891e6f761267312885da134d /msgpack/fallback.py | |
parent | 39f8aa78c7bc6b6b18a1c814a0c296f55242f028 (diff) | |
download | msgpack-python-2b5f59166beeccde0ee230c8673cf50932c8daba.tar.gz |
fallback: Fix warning stacklevel (#327)
Diffstat (limited to 'msgpack/fallback.py')
-rw-r--r-- | msgpack/fallback.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/msgpack/fallback.py b/msgpack/fallback.py index b9ef296..04fb5b9 100644 --- a/msgpack/fallback.py +++ b/msgpack/fallback.py @@ -89,7 +89,7 @@ def _get_data_from_buffer(obj): warnings.warn("using old buffer interface to unpack %s; " "this leads to unpacking errors if slicing is used and " "will be removed in a future version" % type(obj), - RuntimeWarning) + RuntimeWarning, stacklevel=3) else: raise if view.itemsize != 1: @@ -100,7 +100,7 @@ def _get_data_from_buffer(obj): def unpack(stream, **kwargs): warnings.warn( "Direct calling implementation's unpack() is deprecated, Use msgpack.unpack() or unpackb() instead.", - DeprecationWarning) + DeprecationWarning, stacklevel=2) data = stream.read() return unpackb(data, **kwargs) @@ -226,7 +226,7 @@ class Unpacker(object): if encoding is not None: warnings.warn( "encoding is deprecated, Use raw=False instead.", - DeprecationWarning) + DeprecationWarning, stacklevel=2) if unicode_errors is None: unicode_errors = 'strict' @@ -712,7 +712,7 @@ class Packer(object): else: warnings.warn( "encoding is deprecated, Use raw=False instead.", - DeprecationWarning) + DeprecationWarning, stacklevel=2) if unicode_errors is None: unicode_errors = 'strict' |