mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-19 20:03:16 +00:00
fallback: Fix warning stacklevel (#327)
This commit is contained in:
parent
39f8aa78c7
commit
2b5f59166b
1 changed files with 4 additions and 4 deletions
|
@ -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'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue