Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f6145655b | ||
|
|
f6358a68f0 | ||
|
|
e038c84ca9 | ||
|
|
1f3ccd1298 | ||
|
|
ab1835df5c | ||
|
|
92adfaad2b | ||
|
|
ed40d04ac4 | ||
|
|
c56579bb0c | ||
|
|
8343d5a7bf | ||
|
|
5bccd32bbd | ||
|
|
bf5a69acad | ||
|
|
f6d90cef12 | ||
|
|
e0b8cebf6e | ||
|
|
ca85b0da24 |
@ -7,6 +7,7 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
|
||||
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
|
||||
cmake imagemagick libharfbuzz-dev libfribidi-dev
|
||||
|
||||
pip install --upgrade pip
|
||||
PYTHONOPTIMIZE=0 pip install cffi
|
||||
pip install coverage
|
||||
pip install olefile
|
||||
@ -20,7 +21,7 @@ if [[ $TRAVIS_PYTHON_VERSION == 3.* ]]; then
|
||||
# "ERROR: Could not find a version that satisfies the requirement pyqt5"
|
||||
if [[ $TRAVIS_CPU_ARCH == "amd64" ]]; then
|
||||
sudo apt-get -qq install pyqt5-dev-tools
|
||||
pip install pyqt5!=5.14.1
|
||||
pip install pyqt5
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
12
CHANGES.rst
12
CHANGES.rst
@ -2,6 +2,18 @@
|
||||
Changelog (Pillow)
|
||||
==================
|
||||
|
||||
7.1.2 (2020-04-25)
|
||||
------------------
|
||||
|
||||
- Raise an EOFError when seeking too far in PNG #4528
|
||||
[radarhere]
|
||||
|
||||
7.1.1 (2020-04-02)
|
||||
------------------
|
||||
|
||||
- Fix regression seeking and telling PNGs #4512 #4514
|
||||
[hugovk, radarhere]
|
||||
|
||||
7.1.0 (2020-04-01)
|
||||
------------------
|
||||
|
||||
|
||||
@ -629,6 +629,17 @@ class TestFilePng:
|
||||
with Image.open(test_file) as reloaded:
|
||||
assert reloaded.info["exif"] == b"Exif\x00\x00exifstring"
|
||||
|
||||
def test_tell(self):
|
||||
with Image.open(TEST_PNG_FILE) as im:
|
||||
assert im.tell() == 0
|
||||
|
||||
def test_seek(self):
|
||||
with Image.open(TEST_PNG_FILE) as im:
|
||||
im.seek(0)
|
||||
|
||||
with pytest.raises(EOFError):
|
||||
im.seek(1)
|
||||
|
||||
|
||||
@pytest.mark.skipif(is_win32(), reason="Requires Unix or macOS")
|
||||
@skip_unless_feature("zlib")
|
||||
|
||||
@ -229,7 +229,7 @@ Plugin reference
|
||||
----------------------------
|
||||
|
||||
.. automodule:: PIL.PngImagePlugin
|
||||
:members: ChunkStream, PngImageFile, PngStream, getchunks, is_cid, putchunk
|
||||
:members: ChunkStream, PngStream, getchunks, is_cid, putchunk
|
||||
:show-inheritance:
|
||||
.. autoclass:: PIL.PngImagePlugin.ChunkStream
|
||||
:members:
|
||||
|
||||
25
docs/releasenotes/7.1.1.rst
Normal file
25
docs/releasenotes/7.1.1.rst
Normal file
@ -0,0 +1,25 @@
|
||||
7.1.1
|
||||
-----
|
||||
|
||||
Fix regression seeking PNG files
|
||||
================================
|
||||
|
||||
This fixes a regression introduced in 7.1.0 when adding support for APNG files when calling
|
||||
``seek`` and ``tell``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> from PIL import Image
|
||||
>>> with Image.open("Tests/images/hopper.png") as im:
|
||||
... im.seek(0)
|
||||
...
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 2, in <module>
|
||||
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/PngImagePlugin.py", line 739, in seek
|
||||
if not self._seek_check(frame):
|
||||
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/ImageFile.py", line 306, in _seek_check
|
||||
return self.tell() != frame
|
||||
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PIL/PngImagePlugin.py", line 827, in tell
|
||||
return self.__frame
|
||||
AttributeError: 'PngImageFile' object has no attribute '_PngImageFile__frame'
|
||||
>>>
|
||||
16
docs/releasenotes/7.1.2.rst
Normal file
16
docs/releasenotes/7.1.2.rst
Normal file
@ -0,0 +1,16 @@
|
||||
7.1.2
|
||||
-----
|
||||
|
||||
Fix another regression seeking PNG files
|
||||
========================================
|
||||
|
||||
This fixes a regression introduced in 7.1.0 when adding support for APNG files.
|
||||
|
||||
When calling ``seek(n)`` on a regular PNG where ``n > 0``, it failed to raise an
|
||||
``EOFError`` as it should have done, resulting in:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
AttributeError: 'NoneType' object has no attribute 'read'
|
||||
|
||||
Pillow 7.1.2 now raises the correct exception.
|
||||
@ -6,6 +6,8 @@ Release Notes
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
7.1.2
|
||||
7.1.1
|
||||
7.1.0
|
||||
7.0.0
|
||||
6.2.2
|
||||
|
||||
@ -636,6 +636,7 @@ class PngImageFile(ImageFile.ImageFile):
|
||||
if self.fp.read(8) != _MAGIC:
|
||||
raise SyntaxError("not a PNG file")
|
||||
self.__fp = self.fp
|
||||
self.__frame = 0
|
||||
|
||||
#
|
||||
# Parse headers up to the first IDAT or fDAT chunk
|
||||
@ -672,7 +673,7 @@ class PngImageFile(ImageFile.ImageFile):
|
||||
self._text = None
|
||||
self.tile = self.png.im_tile
|
||||
self.custom_mimetype = self.png.im_custom_mimetype
|
||||
self._n_frames = self.png.im_n_frames
|
||||
self.n_frames = self.png.im_n_frames or 1
|
||||
self.default_image = self.info.get("default_image", False)
|
||||
|
||||
if self.png.im_palette:
|
||||
@ -684,15 +685,16 @@ class PngImageFile(ImageFile.ImageFile):
|
||||
else:
|
||||
self.__prepare_idat = length # used by load_prepare()
|
||||
|
||||
if self._n_frames is not None:
|
||||
if self.png.im_n_frames is not None:
|
||||
self._close_exclusive_fp_after_loading = False
|
||||
self.png.save_rewind()
|
||||
self.__rewind_idat = self.__prepare_idat
|
||||
self.__rewind = self.__fp.tell()
|
||||
if self.default_image:
|
||||
# IDAT chunk contains default image and not first animation frame
|
||||
self._n_frames += 1
|
||||
self.n_frames += 1
|
||||
self._seek(0)
|
||||
self.is_animated = self.n_frames > 1
|
||||
|
||||
@property
|
||||
def text(self):
|
||||
@ -709,16 +711,6 @@ class PngImageFile(ImageFile.ImageFile):
|
||||
self.seek(frame)
|
||||
return self._text
|
||||
|
||||
@property
|
||||
def n_frames(self):
|
||||
if self._n_frames is None:
|
||||
return 1
|
||||
return self._n_frames
|
||||
|
||||
@property
|
||||
def is_animated(self):
|
||||
return self._n_frames is not None and self._n_frames > 1
|
||||
|
||||
def verify(self):
|
||||
"""Verify PNG file"""
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
# Master version for Pillow
|
||||
__version__ = "7.1.0"
|
||||
__version__ = "7.1.2"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user