Skip to content

Commit 94751da

Browse files
committed
Initialise __physical_frame = 0 and add pickle roundtrip tell test
1 parent f589f86 commit 94751da

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Tests/test_pickle.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,14 @@ def test_pickle_la_mode_with_palette(tmp_path):
8282

8383
im.mode = "PA"
8484
assert im == loaded_im
85+
86+
87+
def test_pickle_tell():
88+
# Arrange
89+
image = Image.open("Tests/images/hopper.webp")
90+
91+
# Act: roundtrip
92+
unpickled_image = pickle.loads(pickle.dumps(image))
93+
94+
# Assert
95+
assert unpickled_image.tell() == 0

src/PIL/WebPImagePlugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class WebPImageFile(ImageFile.ImageFile):
4040
format_description = "WebP image"
4141
__loaded = -1
4242
__logical_frame = 0
43+
__physical_frame = 0
4344

4445
def _open(self):
4546
if not _webp.HAVE_WEBPANIM:

0 commit comments

Comments
 (0)