Skip to content

Commit

Permalink
Merge pull request #4191 from jdufresne/defer
Browse files Browse the repository at this point in the history
Reuse deferred_error instead of _imaging_not_installed
  • Loading branch information
hugovk authored Nov 3, 2019
2 parents 6060ed3 + 4483642 commit 69a5187
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ class DecompressionBombError(Exception):
pass


class _imaging_not_installed(object):
# module placeholder
def __getattr__(self, id):
raise ImportError("The _imaging C module is not installed")


# Limit to around a quarter gigabyte for a 24 bit (3 bpp) image
MAX_IMAGE_PIXELS = int(1024 * 1024 * 1024 // 4 // 3)

Expand All @@ -95,7 +89,7 @@ def __getattr__(self, id):
)

except ImportError as v:
core = _imaging_not_installed()
core = deferred_error(ImportError("The _imaging C module is not installed."))
# 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
Expand Down

0 comments on commit 69a5187

Please sign in to comment.