Skip to content

Commit 83864b0

Browse files
committed
Removed Image.show command parameter
1 parent 4990404 commit 83864b0

File tree

6 files changed

+54
-39
lines changed

6 files changed

+54
-39
lines changed

Tests/test_image.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
import pytest
88

9-
import PIL
10-
from PIL import Image, ImageDraw, ImagePalette, ImageShow, UnidentifiedImageError
9+
from PIL import Image, ImageDraw, ImagePalette, UnidentifiedImageError
1110

1211
from .helper import (
1312
assert_image_equal,
@@ -832,18 +831,6 @@ def test_fli_overrun2(self):
832831
except OSError as e:
833832
assert str(e) == "buffer overrun when reading image file"
834833

835-
def test_show_deprecation(self, monkeypatch):
836-
monkeypatch.setattr(Image, "_show", lambda *args, **kwargs: None)
837-
838-
im = Image.new("RGB", (50, 50), "white")
839-
840-
with pytest.warns(None) as raised:
841-
im.show()
842-
assert not raised
843-
844-
with pytest.warns(DeprecationWarning):
845-
im.show(command="mock")
846-
847834

848835
class MockEncoder:
849836
pass

docs/deprecations.rst

+9-8
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@ vulnerability introduced in FreeType 2.6 (:cve:`CVE-2020-15999`).
2525

2626
.. _2.10.4: https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/
2727

28-
Image.show command parameter
29-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30-
31-
.. deprecated:: 7.2.0
32-
33-
The ``command`` parameter will be removed in Pillow 9.0.0 (2022-01-02).
34-
Use a subclass of :py:class:`.ImageShow.Viewer` instead.
35-
3628
Tk/Tcl 8.4
3729
~~~~~~~~~~
3830

@@ -80,6 +72,15 @@ Removed features
8072
Deprecated features are only removed in major releases after an appropriate
8173
period of deprecation has passed.
8274

75+
Image.show command parameter
76+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77+
78+
.. deprecated:: 7.2.0
79+
.. versionremoved:: 9.0.0
80+
81+
The ``command`` parameter has been removed. Use a subclass of
82+
:py:class:`.ImageShow.Viewer` instead.
83+
8384
Image._showxv
8485
~~~~~~~~~~~~~
8586

docs/releasenotes/9.0.0.rst

+42-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,53 @@ PILLOW_VERSION constant
99

1010
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
1111

12-
ImageFile.raise_ioerror
13-
~~~~~~~~~~~~~~~~~~~~~~~
12+
Image.show command parameter
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1414

15-
``IOError`` was merged into ``OSError`` in Python 3.3. So, ``ImageFile.raise_ioerror``
16-
has been removed. Use ``ImageFile.raise_oserror`` instead.
15+
The ``command`` parameter has been removed. Use a subclass of
16+
:py:class:`PIL.ImageShow.Viewer` instead.
1717

1818
Image._showxv
1919
~~~~~~~~~~~~~
2020

2121
``Image._showxv`` has been removed. Use :py:meth:`~PIL.Image.Image.show`
2222
instead. If custom behaviour is required, use :py:meth:`~PIL.ImageShow.register` to add
2323
a custom :py:class:`~PIL.ImageShow.Viewer` class.
24+
25+
ImageFile.raise_ioerror
26+
~~~~~~~~~~~~~~~~~~~~~~~
27+
28+
``IOError`` was merged into ``OSError`` in Python 3.3. So, ``ImageFile.raise_ioerror``
29+
has been removed. Use ``ImageFile.raise_oserror`` instead.
30+
31+
API Changes
32+
===========
33+
34+
TODO
35+
^^^^
36+
37+
TODO
38+
39+
API Additions
40+
=============
41+
42+
TODO
43+
^^^^
44+
45+
TODO
46+
47+
Security
48+
========
49+
50+
TODO
51+
^^^^
52+
53+
TODO
54+
55+
Other Changes
56+
=============
57+
58+
TODO
59+
^^^^
60+
61+
TODO

src/PIL/Image.py

+2-9
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,7 @@ def seek(self, frame):
22472247
if frame != 0:
22482248
raise EOFError
22492249

2250-
def show(self, title=None, command=None):
2250+
def show(self, title=None):
22512251
"""
22522252
Displays this image. This method is mainly intended for debugging purposes.
22532253
@@ -2267,14 +2267,7 @@ def show(self, title=None, command=None):
22672267
:param title: Optional title to use for the image window, where possible.
22682268
"""
22692269

2270-
if command is not None:
2271-
warnings.warn(
2272-
"The command parameter is deprecated and will be removed in Pillow 9 "
2273-
"(2022-01-02). Use a subclass of ImageShow.Viewer instead.",
2274-
DeprecationWarning,
2275-
)
2276-
2277-
_show(self, title=title, command=command)
2270+
_show(self, title=title)
22782271

22792272
def split(self):
22802273
"""

src/PIL/ImageFile.py

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import io
3131
import struct
3232
import sys
33-
import warnings
3433

3534
from . import Image
3635
from ._util import isPath

src/PIL/__init__.py

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
;-)
1414
"""
1515

16-
import sys
17-
import warnings
18-
1916
from . import _version
2017

2118
# VERSION was removed in Pillow 6.0.0.

0 commit comments

Comments
 (0)