From 338e067ec4a20f8b7d70caf174754ebfb7a29968 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Wed, 12 Jul 2023 15:11:48 +0100 Subject: [PATCH] Pillow: mark MAX_IMAGE_PIXELS as non-final (#10445) --- stubs/Pillow/PIL/Image.pyi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stubs/Pillow/PIL/Image.pyi b/stubs/Pillow/PIL/Image.pyi index 9aeabdb06..14c95dad8 100644 --- a/stubs/Pillow/PIL/Image.pyi +++ b/stubs/Pillow/PIL/Image.pyi @@ -3,7 +3,7 @@ from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequen from enum import IntEnum from pathlib import Path from typing import Any, ClassVar, Protocol, SupportsBytes -from typing_extensions import Final, Literal, Self, TypeAlias, TypeGuard +from typing_extensions import Literal, Self, TypeAlias, TypeGuard from PIL.PyAccess import PyAccess @@ -39,7 +39,12 @@ class _Writeable(SupportsWrite[bytes], Protocol): class DecompressionBombWarning(RuntimeWarning): ... class DecompressionBombError(Exception): ... -MAX_IMAGE_PIXELS: Final[int] +# Despite the ALL_CAPS spelling, Pillow's docs mention that this threshold can +# be altered at runtime. See +# https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.open +# or the permalink +# https://github.com/python-pillow/Pillow/blob/10.0.0/docs/reference/Image.rst?plain=1#L54-L55 +MAX_IMAGE_PIXELS: int | None USE_CFFI_ACCESS: bool