diff --git a/src/PIL/ImageCms.py b/src/PIL/ImageCms.py index ec10230f12b..b838b779c05 100644 --- a/src/PIL/ImageCms.py +++ b/src/PIL/ImageCms.py @@ -23,7 +23,7 @@ import sys from enum import IntEnum, IntFlag from functools import reduce -from typing import Any, Literal, SupportsFloat, SupportsInt, Union +from typing import TYPE_CHECKING, Any, Literal, SupportsFloat, SupportsInt, Union from . import Image, __version__ from ._deprecate import deprecate @@ -391,9 +391,10 @@ def get_display_profile(handle: SupportsInt | None = None) -> ImageCmsProfile | # pyCMS compatible layer # --------------------------------------------------------------------. -_CmsProfileCompatible = Union[ - str, SupportsRead[bytes], core.CmsProfile, ImageCmsProfile -] +if TYPE_CHECKING: + _CmsProfileCompatible = Union[ + str, SupportsRead[bytes], core.CmsProfile, ImageCmsProfile + ] class PyCMSError(Exception):