Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove long-deprecated Image.py functions #4798

Merged
merged 5 commits into from Jul 24, 2020

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jul 17, 2020

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 and fromstring were deprecated in 2013, and Image.offset in 2001. They've raised either a DeprecationWarning, Exception or NotImplementedError for a long time. Let's remove them.


im.tostring and fromstring

2000: added

Image.tostring, im.tostring and im.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, and tostring was deprecated, raising DeprecationWarning: tostring() is deprecated. Please call tobytes() instead. And similarly with fromstring/frombytes (#35 & #71).

2015: Exception

In Pillow 3.0.0 (Oct 2015), the DeprecationWarning was replaced with an Exception (#1343).

2016: NotImplementedError

In Pillow 3.3.0 (July 2016), the Exception was replaced with a NotImplementedError (#1862).

NotImplementedError means this, and doesn't quite fit:

In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added.

Note: It should not be used to indicate that an operator or method is not meant to be supported at all – in that case either leave the operator / method undefined or, if a subclass, set it to None.

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 a DeprecationWarning in 1.1.5 (March 2005), then as above: Exception in Pillow 3.0.0 (Oct 2015), NotImplementedError in 3.3.0 (July 2016).

@hugovk hugovk added the Removal Removal of a feature, usually done in major releases label Jul 17, 2020
@hugovk hugovk added this to the 8.0.0 milestone Jul 17, 2020
docs/deprecations.rst Outdated Show resolved Hide resolved
docs/deprecations.rst Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
docs/reference/Image.rst Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@radarhere radarhere merged commit 11de331 into python-pillow:master Jul 24, 2020
@hugovk hugovk deleted the rm-deprecated-notimplemented branch July 24, 2020 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Removal Removal of a feature, usually done in major releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants