@@ -89,7 +89,7 @@ def _get_data_from_buffer(obj):
8989 warnings .warn ("using old buffer interface to unpack %s; "
9090 "this leads to unpacking errors if slicing is used and "
9191 "will be removed in a future version" % type (obj ),
92- RuntimeWarning )
92+ RuntimeWarning , stacklevel = 3 )
9393 else :
9494 raise
9595 if view .itemsize != 1 :
@@ -100,7 +100,7 @@ def _get_data_from_buffer(obj):
100100def unpack (stream , ** kwargs ):
101101 warnings .warn (
102102 "Direct calling implementation's unpack() is deprecated, Use msgpack.unpack() or unpackb() instead." ,
103- DeprecationWarning )
103+ DeprecationWarning , stacklevel = 2 )
104104 data = stream .read ()
105105 return unpackb (data , ** kwargs )
106106
@@ -226,7 +226,7 @@ def __init__(self, file_like=None, read_size=0, use_list=True, raw=True,
226226 if encoding is not None :
227227 warnings .warn (
228228 "encoding is deprecated, Use raw=False instead." ,
229- DeprecationWarning )
229+ DeprecationWarning , stacklevel = 2 )
230230
231231 if unicode_errors is None :
232232 unicode_errors = 'strict'
@@ -712,7 +712,7 @@ def __init__(self, default=None, encoding=None, unicode_errors=None,
712712 else :
713713 warnings .warn (
714714 "encoding is deprecated, Use raw=False instead." ,
715- DeprecationWarning )
715+ DeprecationWarning , stacklevel = 2 )
716716
717717 if unicode_errors is None :
718718 unicode_errors = 'strict'
0 commit comments