Skip to content

test_file_blp.py fails with libjpeg 9e since 9.3.0 #6741

Closed
@kulikjak

Description

What did you do?

I built Pillow 9.3.0 as downloaded from PyPI and ran the test suite with the following command:
/usr/bin/python3.X -m pytest Tests/test_file_blp.py

What did you expect to happen?

Every test passes.

What actually happened?

test_load_blp1 failed with the following error:

    def test_load_blp1():
        with Image.open("Tests/images/blp/blp1_jpeg.blp") as im:
>           assert_image_equal_tofile(im, "Tests/images/blp/blp1_jpeg.png")

Tests/test_file_blp.py:15: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
Tests/helper.py:105: in assert_image_equal_tofile
    assert_image_equal(a, img, msg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <PIL.BlpImagePlugin.BlpImageFile image mode=RGB size=256x256 at 0x7FF952EF3AD10>
b = <PIL.PngImagePlugin.PngImageFile image mode=RGB size=256x256 at 0x7FF952EF3AF10>, msg = None

    def assert_image_equal(a, b, msg=None):
        assert a.mode == b.mode, msg or f"got mode {repr(a.mode)}, expected {repr(b.mode)}"
        assert a.size == b.size, msg or f"got size {repr(a.size)}, expected {repr(b.size)}"
        if a.tobytes() != b.tobytes():
            if HAS_UPLOADER:
                try:
                    url = test_image_results.upload(a, b)
                    logger.error(f"Url for test images: {url}")
                except Exception:
                    pass
    
>           assert False, msg or "got different content"
E           AssertionError: got different content
E           assert False

I don't see this failure in 9.2.0 - it seems that f7363c1 caused this issue. When I revert it, the issue is gone (when I revert only the BlpImagePlugin.py change, pillow segfaults on newly added test_file_blp.py code, but it passes the assert_image_equal_tofile part this failure is about.

This happens on both SPARC and Intel meaning than endianness is most likely not the issue.

What are your OS, Python and Pillow versions?

  • OS: Oracle Solaris 11.4 (both on SPARC and x86)
  • Python: 3.7.14, 3.9.14 and 3.11.0
  • Pillow: 9.3.0

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions