mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-29 18:54:16 +03:00
Removed Image.show command parameter
This commit is contained in:
parent
499040491b
commit
83864b01cf
|
@ -6,8 +6,7 @@ import tempfile
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import PIL
|
from PIL import Image, ImageDraw, ImagePalette, UnidentifiedImageError
|
||||||
from PIL import Image, ImageDraw, ImagePalette, ImageShow, UnidentifiedImageError
|
|
||||||
|
|
||||||
from .helper import (
|
from .helper import (
|
||||||
assert_image_equal,
|
assert_image_equal,
|
||||||
|
@ -832,18 +831,6 @@ class TestImage:
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
assert str(e) == "buffer overrun when reading image file"
|
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:
|
class MockEncoder:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -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/
|
.. _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
|
Tk/Tcl 8.4
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -80,6 +72,15 @@ Removed features
|
||||||
Deprecated features are only removed in major releases after an appropriate
|
Deprecated features are only removed in major releases after an appropriate
|
||||||
period of deprecation has passed.
|
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
|
Image._showxv
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,11 @@ PILLOW_VERSION constant
|
||||||
|
|
||||||
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
|
``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``
|
The ``command`` parameter has been removed. Use a subclass of
|
||||||
has been removed. Use ``ImageFile.raise_oserror`` instead.
|
:py:class:`PIL.ImageShow.Viewer` instead.
|
||||||
|
|
||||||
Image._showxv
|
Image._showxv
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
@ -21,3 +21,41 @@ Image._showxv
|
||||||
``Image._showxv`` has been removed. Use :py:meth:`~PIL.Image.Image.show`
|
``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
|
instead. If custom behaviour is required, use :py:meth:`~PIL.ImageShow.register` to add
|
||||||
a custom :py:class:`~PIL.ImageShow.Viewer` class.
|
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
|
||||||
|
|
|
@ -2247,7 +2247,7 @@ class Image:
|
||||||
if frame != 0:
|
if frame != 0:
|
||||||
raise EOFError
|
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.
|
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.
|
:param title: Optional title to use for the image window, where possible.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if command is not None:
|
_show(self, title=title)
|
||||||
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)
|
|
||||||
|
|
||||||
def split(self):
|
def split(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
import io
|
import io
|
||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
|
|
||||||
from . import Image
|
from . import Image
|
||||||
from ._util import isPath
|
from ._util import isPath
|
||||||
|
|
|
@ -13,9 +13,6 @@ Use PIL.__version__ for this Pillow version.
|
||||||
;-)
|
;-)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
from . import _version
|
from . import _version
|
||||||
|
|
||||||
# VERSION was removed in Pillow 6.0.0.
|
# VERSION was removed in Pillow 6.0.0.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user