diff --git a/Tests/test_image.py b/Tests/test_image.py index 1aa810e22..83b027aa2 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -1132,10 +1132,6 @@ class TestImage: assert len(caplog.records) == 0 assert im.fp is None - def test_deprecation(self) -> None: - with pytest.warns(DeprecationWarning, match="Image.isImageType"): - assert not Image.isImageType(None) - class TestImageBytes: @pytest.mark.parametrize("mode", Image.MODES) diff --git a/docs/deprecations.rst b/docs/deprecations.rst index b4eb1fa4c..5ecd7de42 100644 --- a/docs/deprecations.rst +++ b/docs/deprecations.rst @@ -123,14 +123,6 @@ ICNS (width, height, scale) sizes Setting an ICNS image size to ``(width, height, scale)`` before loading has been deprecated. Instead, ``load(scale)`` can be used. -Image isImageType() -^^^^^^^^^^^^^^^^^^^ - -.. deprecated:: 11.0.0 - -``Image.isImageType(im)`` has been deprecated. Use ``isinstance(im, Image.Image)`` -instead. - ImageMath.lambda_eval and ImageMath.unsafe_eval options parameter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -222,6 +214,15 @@ BGR;15, BGR 16 and BGR;24 The experimental BGR;15, BGR;16 and BGR;24 modes have been removed. +Image isImageType() +^^^^^^^^^^^^^^^^^^^ + +.. deprecated:: 11.0.0 +.. versionremoved:: 12.0.0 + +``Image.isImageType(im)`` has been removed. Use ``isinstance(im, Image.Image)`` +instead. + TiffImagePlugin IFD_LEGACY_API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 9df253498..59168f5e3 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -115,21 +115,6 @@ except ImportError as v: raise -def isImageType(t: Any) -> TypeGuard[Image]: - """ - Checks if an object is an image object. - - .. warning:: - - This function is for internal use only. - - :param t: object to check if it's an image - :returns: True if the object is an image - """ - deprecate("Image.isImageType(im)", 12, "isinstance(im, Image.Image)") - return hasattr(t, "im") - - # # Constants @@ -219,7 +204,7 @@ if TYPE_CHECKING: from IPython.lib.pretty import PrettyPrinter from . import ImageFile, ImageFilter, ImagePalette, ImageQt, TiffImagePlugin - from ._typing import CapsuleType, NumpyArray, StrOrBytesPath, TypeGuard + from ._typing import CapsuleType, NumpyArray, StrOrBytesPath ID: list[str] = [] OPEN: dict[ str,