Skip to content

Conversation

@radarhere
Copy link
Member

There's no need to set core in

core = DeferredError.new(ImportError("The _imaging C module is not installed."))

if we're just going to raise a few lines later, and not use it in between.

Pillow/src/PIL/Image.py

Lines 107 to 120 in 34c651d

# Explanations for ways that we know we might have an import error
if str(v).startswith("Module use of python"):
# The _imaging C module is present, but not compiled for
# the right version (windows only). Print a warning, if
# possible.
warnings.warn(
"The _imaging extension was built for another version of Python.",
RuntimeWarning,
)
elif str(v).startswith("The _imaging extension"):
warnings.warn(str(v), RuntimeWarning)
# Fail here anyway. Don't let people run with a mostly broken Pillow.
# see docs/porting.rst
raise

@hugovk hugovk merged commit 9f5d1f7 into python-pillow:main Aug 20, 2025
51 checks passed
@radarhere radarhere deleted the core branch August 20, 2025 21:53
jmarianer added a commit to jmarianer/factorio-tech-tree that referenced this pull request Aug 20, 2025
This requires a change to the lupa and Pillow typing, which are both
still pending (merged but not released).

python/typeshed#14359
python-pillow/Pillow#9166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants