Skip to content

Undocumented breaking change in Pillow 11.0.0 for im attribute #8581

@OvervCW

Description

@OvervCW

What did you do?

image = Image.open(path)

if not image.im:
    print("image still needs to be loaded")

What did you expect to happen?

Originally the im attribute would simply be None if the image was not loaded yet, which you could access to check this.

What actually happened?

Now accessing the im attribute when the image has not been loaded yet results in an assertion error.

What are your OS, Python and Pillow versions?

  • OS: Ubuntu 24.04.1 LTS
  • Python: 3.9.10
  • Pillow: 11.0.0
--------------------------------------------------------------------
Pillow 11.0.0
Python 3.9.10 (main, May 18 2022, 12:54:46)
       [GCC 11.2.0]
--------------------------------------------------------------------
Python executable is /home/alexander/.cache/pypoetry/virtualenvs/blicker-qkSPJuWY-py3.9/bin/python
Environment Python files loaded from /home/alexander/.cache/pypoetry/virtualenvs/blicker-qkSPJuWY-py3.9
System Python files loaded from /home/alexander/.pyenv/versions/3.9.10
--------------------------------------------------------------------
Python Pillow modules loaded from /home/alexander/.cache/pypoetry/virtualenvs/blicker-qkSPJuWY-py3.9/lib/python3.9/site-packages/PIL
Binary Pillow modules loaded from /home/alexander/.cache/pypoetry/virtualenvs/blicker-qkSPJuWY-py3.9/lib/python3.9/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 11.0.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
--- JPEG support ok, compiled for libjpeg-turbo 3.0.4
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.13, harfbuzz 10.0.1
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions