Skip to content

Commit 5d4a054

Browse files
committed
Removed Image isImageType()
1 parent 583f0a5 commit 5d4a054

File tree

3 files changed

+10
-28
lines changed

3 files changed

+10
-28
lines changed

Tests/test_image.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,10 +1132,6 @@ def test_close_graceful(self, caplog: pytest.LogCaptureFixture) -> None:
11321132
assert len(caplog.records) == 0
11331133
assert im.fp is None
11341134

1135-
def test_deprecation(self) -> None:
1136-
with pytest.warns(DeprecationWarning, match="Image.isImageType"):
1137-
assert not Image.isImageType(None)
1138-
11391135

11401136
class TestImageBytes:
11411137
@pytest.mark.parametrize("mode", Image.MODES)

docs/deprecations.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,6 @@ ICNS (width, height, scale) sizes
123123
Setting an ICNS image size to ``(width, height, scale)`` before loading has been
124124
deprecated. Instead, ``load(scale)`` can be used.
125125

126-
Image isImageType()
127-
^^^^^^^^^^^^^^^^^^^
128-
129-
.. deprecated:: 11.0.0
130-
131-
``Image.isImageType(im)`` has been deprecated. Use ``isinstance(im, Image.Image)``
132-
instead.
133-
134126
ImageMath.lambda_eval and ImageMath.unsafe_eval options parameter
135127
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136128

@@ -222,6 +214,15 @@ BGR;15, BGR 16 and BGR;24
222214

223215
The experimental BGR;15, BGR;16 and BGR;24 modes have been removed.
224216

217+
Image isImageType()
218+
^^^^^^^^^^^^^^^^^^^
219+
220+
.. deprecated:: 11.0.0
221+
.. versionremoved:: 12.0.0
222+
223+
``Image.isImageType(im)`` has been removed. Use ``isinstance(im, Image.Image)``
224+
instead.
225+
225226
TiffImagePlugin IFD_LEGACY_API
226227
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
227228

src/PIL/Image.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,6 @@ class DecompressionBombError(Exception):
115115
raise
116116

117117

118-
def isImageType(t: Any) -> TypeGuard[Image]:
119-
"""
120-
Checks if an object is an image object.
121-
122-
.. warning::
123-
124-
This function is for internal use only.
125-
126-
:param t: object to check if it's an image
127-
:returns: True if the object is an image
128-
"""
129-
deprecate("Image.isImageType(im)", 12, "isinstance(im, Image.Image)")
130-
return hasattr(t, "im")
131-
132-
133118
#
134119
# Constants
135120

@@ -219,7 +204,7 @@ class Quantize(IntEnum):
219204
from IPython.lib.pretty import PrettyPrinter
220205

221206
from . import ImageFile, ImageFilter, ImagePalette, ImageQt, TiffImagePlugin
222-
from ._typing import CapsuleType, NumpyArray, StrOrBytesPath, TypeGuard
207+
from ._typing import CapsuleType, NumpyArray, StrOrBytesPath
223208
ID: list[str] = []
224209
OPEN: dict[
225210
str,

0 commit comments

Comments
 (0)