Deprecate isImageType by radarhere · Pull Request #8364 · python-pillow/Pillow
Removes isImageType(), which relies on hasattr(t, "im"),
Lines 125 to 136 in be01d53
| 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 | |
| """ | |
| return hasattr(t, "im") |
and instead uses isinstance(im, Image).
I've also made a similar change in ImageMath, replacing hasattr(v, "im") with isinstance(v, Image.Image).