Remove long-deprecated Image.py functions #4798
Merged
+28
−43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our current approach has been to deprecate for at least a year, and then remove in the next major version. I think this has been working fine (except for
PILLOW_VERSION
which didn't raise deprecation warnings; so we reinstated it with warnings).Image.tostring
andfromstring
were deprecated in 2013, andImage.offset
in 2001. They've raised either aDeprecationWarning
,Exception
orNotImplementedError
for a long time. Let's remove them.im.tostring and fromstring
2000: added
Image.tostring
,im.tostring
andim.fromstring
date back to at least PIL 1.1.1 (Oct 2000), probably earlier.2013: DeprecationWarning
In Pillow 2.0.0 (March 2013), when adding support for Python 3,
tobytes
was added, andtostring
was deprecated, raisingDeprecationWarning: tostring() is deprecated. Please call tobytes() instead.
And similarly withfromstring
/frombytes
(#35 & #71).2015: Exception
In Pillow 3.0.0 (Oct 2015), the
DeprecationWarning
was replaced with anException
(#1343).2016: NotImplementedError
In Pillow 3.3.0 (July 2016), the
Exception
was replaced with aNotImplementedError
(#1862).NotImplementedError
means this, and doesn't quite fit:https://docs.python.org/3/library/exceptions.html#NotImplementedError
im.offset
2001: deprecated
2005: DeprecationWarning
2015: Exception
2001: NotImplementedError
Image.offset
followed a similar path, except it was documented as deprecated in PIL 1.1.2 (May 2001), raised aDeprecationWarning
in 1.1.5 (March 2005), then as above:Exception
in Pillow 3.0.0 (Oct 2015),NotImplementedError
in 3.3.0 (July 2016).