mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-09-09 22:02:27 +03:00
Deprecate Image._show
This commit is contained in:
parent
208e9b52dc
commit
877707379b
|
@ -19,6 +19,7 @@ from PIL import (
|
|||
ImageDraw,
|
||||
ImageFile,
|
||||
ImagePalette,
|
||||
ImageShow,
|
||||
UnidentifiedImageError,
|
||||
features,
|
||||
)
|
||||
|
@ -1047,6 +1048,13 @@ class TestImage:
|
|||
with pytest.warns(DeprecationWarning, match="Image.Image.get_child_images"):
|
||||
assert im.get_child_images() == []
|
||||
|
||||
def test_show(self, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(ImageShow, "_viewers", [])
|
||||
|
||||
im = Image.new("RGB", (1, 1))
|
||||
with pytest.warns(DeprecationWarning, match="Image._show"):
|
||||
Image._show(im)
|
||||
|
||||
@pytest.mark.parametrize("size", ((1, 0), (0, 1), (0, 0)))
|
||||
def test_zero_tobytes(self, size: tuple[int, int]) -> None:
|
||||
im = Image.new("RGB", size)
|
||||
|
|
|
@ -61,6 +61,14 @@ ImageCms.ImageCmsProfile.product_name and .product_info
|
|||
``.product_info`` attributes have been deprecated, and will be removed in
|
||||
Pillow 13 (2026-10-15). They have been set to ``None`` since Pillow 2.3.0.
|
||||
|
||||
Image._show
|
||||
~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 12.0.0
|
||||
|
||||
``Image._show`` has been deprecated, and will be removed in Pillow 13 (2026-10-15).
|
||||
Use :py:meth:`~PIL.ImageShow.show` instead.
|
||||
|
||||
Removed features
|
||||
----------------
|
||||
|
||||
|
|
|
@ -116,6 +116,12 @@ vulnerability introduced in FreeType 2.6 (:cve:`2020-15999`).
|
|||
Deprecations
|
||||
============
|
||||
|
||||
Image._show
|
||||
^^^^^^^^^^^
|
||||
|
||||
``Image._show`` has been deprecated, and will be removed in Pillow 13 (2026-10-15).
|
||||
Use :py:meth:`~PIL.ImageShow.show` instead.
|
||||
|
||||
ImageCms.ImageCmsProfile.product_name and .product_info
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -2632,7 +2632,9 @@ class Image:
|
|||
:param title: Optional title to use for the image window, where possible.
|
||||
"""
|
||||
|
||||
_show(self, title=title)
|
||||
from . import ImageShow
|
||||
|
||||
ImageShow.show(self, title)
|
||||
|
||||
def split(self) -> tuple[Image, ...]:
|
||||
"""
|
||||
|
@ -3797,6 +3799,7 @@ def register_encoder(name: str, encoder: type[ImageFile.PyEncoder]) -> None:
|
|||
def _show(image: Image, **options: Any) -> None:
|
||||
from . import ImageShow
|
||||
|
||||
deprecate("Image._show", 13, "ImageShow.show")
|
||||
ImageShow.show(image, **options)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user