Removed Image.show command parameter

This commit is contained in:
Andrew Murray 2021-10-18 11:08:51 +11:00
parent 499040491b
commit 83864b01cf
6 changed files with 54 additions and 39 deletions

View File

@ -6,8 +6,7 @@ import tempfile
import pytest
import PIL
from PIL import Image, ImageDraw, ImagePalette, ImageShow, UnidentifiedImageError
from PIL import Image, ImageDraw, ImagePalette, UnidentifiedImageError
from .helper import (
assert_image_equal,
@ -832,18 +831,6 @@ class TestImage:
except OSError as e:
assert str(e) == "buffer overrun when reading image file"
def test_show_deprecation(self, monkeypatch):
monkeypatch.setattr(Image, "_show", lambda *args, **kwargs: None)
im = Image.new("RGB", (50, 50), "white")
with pytest.warns(None) as raised:
im.show()
assert not raised
with pytest.warns(DeprecationWarning):
im.show(command="mock")
class MockEncoder:
pass

View File

@ -25,14 +25,6 @@ vulnerability introduced in FreeType 2.6 (:cve:`CVE-2020-15999`).
.. _2.10.4: https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/
Image.show command parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. deprecated:: 7.2.0
The ``command`` parameter will be removed in Pillow 9.0.0 (2022-01-02).
Use a subclass of :py:class:`.ImageShow.Viewer` instead.
Tk/Tcl 8.4
~~~~~~~~~~
@ -80,6 +72,15 @@ Removed features
Deprecated features are only removed in major releases after an appropriate
period of deprecation has passed.
Image.show command parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. deprecated:: 7.2.0
.. versionremoved:: 9.0.0
The ``command`` parameter has been removed. Use a subclass of
:py:class:`.ImageShow.Viewer` instead.
Image._showxv
~~~~~~~~~~~~~

View File

@ -9,11 +9,11 @@ PILLOW_VERSION constant
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
ImageFile.raise_ioerror
~~~~~~~~~~~~~~~~~~~~~~~
Image.show command parameter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``IOError`` was merged into ``OSError`` in Python 3.3. So, ``ImageFile.raise_ioerror``
has been removed. Use ``ImageFile.raise_oserror`` instead.
The ``command`` parameter has been removed. Use a subclass of
:py:class:`PIL.ImageShow.Viewer` instead.
Image._showxv
~~~~~~~~~~~~~
@ -21,3 +21,41 @@ Image._showxv
``Image._showxv`` has been removed. Use :py:meth:`~PIL.Image.Image.show`
instead. If custom behaviour is required, use :py:meth:`~PIL.ImageShow.register` to add
a custom :py:class:`~PIL.ImageShow.Viewer` class.
ImageFile.raise_ioerror
~~~~~~~~~~~~~~~~~~~~~~~
``IOError`` was merged into ``OSError`` in Python 3.3. So, ``ImageFile.raise_ioerror``
has been removed. Use ``ImageFile.raise_oserror`` instead.
API Changes
===========
TODO
^^^^
TODO
API Additions
=============
TODO
^^^^
TODO
Security
========
TODO
^^^^
TODO
Other Changes
=============
TODO
^^^^
TODO

View File

@ -2247,7 +2247,7 @@ class Image:
if frame != 0:
raise EOFError
def show(self, title=None, command=None):
def show(self, title=None):
"""
Displays this image. This method is mainly intended for debugging purposes.
@ -2267,14 +2267,7 @@ class Image:
:param title: Optional title to use for the image window, where possible.
"""
if command is not None:
warnings.warn(
"The command parameter is deprecated and will be removed in Pillow 9 "
"(2022-01-02). Use a subclass of ImageShow.Viewer instead.",
DeprecationWarning,
)
_show(self, title=title, command=command)
_show(self, title=title)
def split(self):
"""

View File

@ -30,7 +30,6 @@
import io
import struct
import sys
import warnings
from . import Image
from ._util import isPath

View File

@ -13,9 +13,6 @@ Use PIL.__version__ for this Pillow version.
;-)
"""
import sys
import warnings
from . import _version
# VERSION was removed in Pillow 6.0.0.