Fixed exceptions when closing AppendingTiffWriter#8723
Merged
hugovk merged 1 commit intopython-pillow:mainfrom Jan 31, 2025
Merged
Fixed exceptions when closing AppendingTiffWriter#8723hugovk merged 1 commit intopython-pillow:mainfrom
hugovk merged 1 commit intopython-pillow:mainfrom
Conversation
hugovk
approved these changes
Jan 31, 2025
Member
hugovk
left a comment
There was a problem hiding this comment.
Please could you add comments to explain why? It won't be obvious in the future without looking up the PR via the blame.
Member
Author
|
If that's confusing, then how about a different solution instead - I've updated the code so that it is now seeking backwards through the data first before the write/rewrite operation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two exceptions are being raised in testing - https://github.com/python-pillow/Pillow/actions/runs/13051364088/job/36412180284#step:11:4911
Tests/test_file_tiff.py::TestFileTiff::test_appending_tiff_writer_writelong /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <PIL.TiffImagePlugin.AppendingTiffWriter object at 0x114c785e0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2212, in close self.finalize() ~~~~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2082, in finalize raise RuntimeError(msg) RuntimeError: IIMM of new page doesn't match IIMM of first page warnings.warn(pytest.PytestUnraisableExceptionWarning(msg)) Tests/test_file_tiff.py::TestFileTiff::test_appending_tiff_writer_rewritelastshorttolong /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <PIL.TiffImagePlugin.AppendingTiffWriter object at 0x114c7ade0> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2212, in close self.finalize() ~~~~~~~~~~~~~^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/PIL/TiffImagePlugin.py", line 2082, in finalize raise RuntimeError(msg) RuntimeError: IIMM of new page doesn't match IIMM of first page warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))These exceptions are occurred when AppendingTiffWriter is being closed at the end of the test method.
Pillow/Tests/test_file_tiff.py
Lines 779 to 791 in e4f2a4a
Since that is after the
assert, the code that is run during close can simply be disabled.