From b72b8dd84d121c919c645963a8675b82c5585dfd Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 1 Jul 2025 20:04:08 +1000 Subject: [PATCH] Removed JpegImageFile.huffman_ac and JpegImageFile.huffman_dc --- Tests/test_file_jpeg.py | 8 -------- docs/deprecations.rst | 17 +++++++++-------- src/PIL/JpegImagePlugin.py | 7 ------- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index 5afae0412..08e879807 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -1115,14 +1115,6 @@ class TestFileJpeg: assert im._repr_jpeg_() is None - def test_deprecation(self) -> None: - with Image.open(TEST_FILE) as im: - assert isinstance(im, JpegImagePlugin.JpegImageFile) - with pytest.warns(DeprecationWarning, match="huffman_ac"): - assert im.huffman_ac == {} - with pytest.warns(DeprecationWarning, match="huffman_dc"): - assert im.huffman_dc == {} - @pytest.mark.skipif(not is_win32(), reason="Windows only") @skip_unless_feature("jpg") diff --git a/docs/deprecations.rst b/docs/deprecations.rst index 4a208f212..8e065fa87 100644 --- a/docs/deprecations.rst +++ b/docs/deprecations.rst @@ -122,14 +122,6 @@ The ``options`` parameter in :py:meth:`~PIL.ImageMath.lambda_eval()` and :py:meth:`~PIL.ImageMath.unsafe_eval()` has been deprecated. One or more keyword arguments can be used instead. -JpegImageFile.huffman_ac and JpegImageFile.huffman_dc -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -.. deprecated:: 11.0.0 - -The ``huffman_ac`` and ``huffman_dc`` dictionaries on JPEG images were unused. They -have been deprecated, and will be removed in Pillow 12 (2025-10-15). - Specific WebP feature checks ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -223,6 +215,15 @@ Image isImageType() ``Image.isImageType(im)`` has been removed. Use ``isinstance(im, Image.Image)`` instead. +JpegImageFile.huffman_ac and JpegImageFile.huffman_dc +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. deprecated:: 11.0.0 +.. versionremoved:: 12.0.0 + +The ``huffman_ac`` and ``huffman_dc`` dictionaries on JPEG images were unused. They +have been deprecated, and will be removed in Pillow 12 (2025-10-15). + TiffImagePlugin IFD_LEGACY_API ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py index defe9f773..082f3551a 100644 --- a/src/PIL/JpegImagePlugin.py +++ b/src/PIL/JpegImagePlugin.py @@ -49,7 +49,6 @@ from ._binary import i16be as i16 from ._binary import i32be as i32 from ._binary import o8 from ._binary import o16be as o16 -from ._deprecate import deprecate from .JpegPresets import presets TYPE_CHECKING = False @@ -393,12 +392,6 @@ class JpegImageFile(ImageFile.ImageFile): self._read_dpi_from_exif() - def __getattr__(self, name: str) -> Any: - if name in ("huffman_ac", "huffman_dc"): - deprecate(name, 12) - return getattr(self, "_" + name) - raise AttributeError(name) - def __getstate__(self) -> list[Any]: return super().__getstate__() + [self.layers, self.layer]