mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-18 20:13:32 +03:00
better warning messages for fromstring/tostring
This commit is contained in:
parent
fbcc9b5c77
commit
aacb8097c3
12
PIL/Image.py
12
PIL/Image.py
|
@ -541,7 +541,11 @@ class Image:
|
||||||
if bytes is str:
|
if bytes is str:
|
||||||
# Declare tostring as alias to tobytes
|
# Declare tostring as alias to tobytes
|
||||||
def tostring(self, *args, **kw):
|
def tostring(self, *args, **kw):
|
||||||
warnings.warn('tostring() is deprecated. Please call tobytes() instead.', DeprecationWarning)
|
warnings.warn(
|
||||||
|
'tostring() is deprecated. Please call tobytes() instead.',
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
return self.tobytes(*args, **kw)
|
return self.tobytes(*args, **kw)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@ -1809,7 +1813,11 @@ def frombytes(mode, size, data, decoder_name="raw", *args):
|
||||||
if bytes is str:
|
if bytes is str:
|
||||||
# Declare fromstring as an alias for frombytes
|
# Declare fromstring as an alias for frombytes
|
||||||
def fromstring(*args, **kw):
|
def fromstring(*args, **kw):
|
||||||
warnings.warn('fromstring() is deprecated. Please call frombytes() instead.', DeprecationWarning)
|
warnings.warn(
|
||||||
|
'fromstring() is deprecated. Please call frombytes() instead.',
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2
|
||||||
|
)
|
||||||
return frombytes(*args, **kw)
|
return frombytes(*args, **kw)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Reference in New Issue
Block a user