Remove long-deprecated Image.py functions #4798
Merged
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_VERSIONwhich didn't raise deprecation warnings; so we reinstated it with warnings).Image.tostringandfromstringwere deprecated in 2013, andImage.offsetin 2001. They've raised either aDeprecationWarning,ExceptionorNotImplementedErrorfor a long time. Let's remove them.im.tostring and fromstring
2000: added
Image.tostring,im.tostringandim.fromstringdate 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,
tobyteswas added, andtostringwas 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
DeprecationWarningwas replaced with anException(#1343).2016: NotImplementedError
In Pillow 3.3.0 (July 2016), the
Exceptionwas replaced with aNotImplementedError(#1862).NotImplementedErrormeans 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.offsetfollowed a similar path, except it was documented as deprecated in PIL 1.1.2 (May 2001), raised aDeprecationWarningin 1.1.5 (March 2005), then as above:Exceptionin Pillow 3.0.0 (Oct 2015),NotImplementedErrorin 3.3.0 (July 2016).