mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Load image before deepcopy(__getstate__)
Signed-off-by: bigcat88 <bigcat88@icloud.com>
This commit is contained in:
parent
a405e8406b
commit
b10379b3c1
|
@ -1,4 +1,5 @@
|
||||||
import warnings
|
import warnings
|
||||||
|
from copy import deepcopy
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -226,6 +227,14 @@ def test_load_first():
|
||||||
assert a.shape == (88, 590)
|
assert a.shape == (88, 590)
|
||||||
|
|
||||||
|
|
||||||
|
@skip_unless_feature("libtiff")
|
||||||
|
def test_load_first_deepcopy():
|
||||||
|
with Image.open("Tests/images/g4_orientation_5.tif") as im:
|
||||||
|
im_deepcopy = deepcopy(im)
|
||||||
|
a = numpy.array(im_deepcopy)
|
||||||
|
assert a.shape == (88, 590)
|
||||||
|
|
||||||
|
|
||||||
def test_bool():
|
def test_bool():
|
||||||
# https://github.com/python-pillow/Pillow/issues/2044
|
# https://github.com/python-pillow/Pillow/issues/2044
|
||||||
a = numpy.zeros((10, 2), dtype=bool)
|
a = numpy.zeros((10, 2), dtype=bool)
|
||||||
|
|
|
@ -672,7 +672,8 @@ class Image:
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def __getstate__(self):
|
def __getstate__(self):
|
||||||
return [self.info, self.mode, self.size, self.getpalette(), self.tobytes()]
|
im_data = self.tobytes() # load image first
|
||||||
|
return [self.info, self.mode, self.size, self.getpalette(), im_data]
|
||||||
|
|
||||||
def __setstate__(self, state):
|
def __setstate__(self, state):
|
||||||
Image.__init__(self)
|
Image.__init__(self)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user