mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 04:13: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; "
|
warnings.warn("using old buffer interface to unpack %s; "
|
||||||
"this leads to unpacking errors if slicing is used and "
|
"this leads to unpacking errors if slicing is used and "
|
||||||
"will be removed in a future version" % type(obj),
|
"will be removed in a future version" % type(obj),
|
||||||
RuntimeWarning)
|
RuntimeWarning, stacklevel=3)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
if view.itemsize != 1:
|
if view.itemsize != 1:
|
||||||
|
@ -100,7 +100,7 @@ def _get_data_from_buffer(obj):
|
||||||
def unpack(stream, **kwargs):
|
def unpack(stream, **kwargs):
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"Direct calling implementation's unpack() is deprecated, Use msgpack.unpack() or unpackb() instead.",
|
"Direct calling implementation's unpack() is deprecated, Use msgpack.unpack() or unpackb() instead.",
|
||||||
DeprecationWarning)
|
DeprecationWarning, stacklevel=2)
|
||||||
data = stream.read()
|
data = stream.read()
|
||||||
return unpackb(data, **kwargs)
|
return unpackb(data, **kwargs)
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ class Unpacker(object):
|
||||||
if encoding is not None:
|
if encoding is not None:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"encoding is deprecated, Use raw=False instead.",
|
"encoding is deprecated, Use raw=False instead.",
|
||||||
DeprecationWarning)
|
DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
if unicode_errors is None:
|
if unicode_errors is None:
|
||||||
unicode_errors = 'strict'
|
unicode_errors = 'strict'
|
||||||
|
@ -712,7 +712,7 @@ class Packer(object):
|
||||||
else:
|
else:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
"encoding is deprecated, Use raw=False instead.",
|
"encoding is deprecated, Use raw=False instead.",
|
||||||
DeprecationWarning)
|
DeprecationWarning, stacklevel=2)
|
||||||
|
|
||||||
if unicode_errors is None:
|
if unicode_errors is None:
|
||||||
unicode_errors = 'strict'
|
unicode_errors = 'strict'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue