#274541 Wrong import order of ImagePlugins

Package:
python-imaging
Source:
pillow
Submitter:
Bernhard Kauer
Date:
2023-04-26 09:01:11 UTC
Severity:
normal
Tags:
#274541#5
Date:
2004-10-02 15:24:17 UTC
From:
To:
PIL.Image loads all *ImagePlugin modules in the function init().
These modules call usually Image.register_open(), which changes the
dict Image.OPEN.

The loading is done in the order of sys.path: from important to less
important. This is a bug because important entries in Image.OPEN are
overwritten by less important one. Instead the order of the
directories needs to reversed here.

To reproduce this bug, store bugtest.py and DummyImagePlugin.py into a
directory and call "python bugtest.py". The output is something like:

	register DummyImagePlugin
	(None, None)
	(<class PIL.TiffImagePlugin.TiffImageFile at 0x40462fbc>,
	<function _accept at 0x4046c224>)

This shows that the "TIFF" entry from DummyImagePlugin is overwritten
by PIL.TiffImagePlugin.

The bug is solved with the attached patch.

Greetings

	Bernhard Kauer

#274541#10
Date:
2004-10-02 15:57:45 UTC
From:
To:
Hi,

I just received this Debian bug report.

Your opinion?