From 32f4097d1e132eb02689a553c89a2bc893dda256 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Sun, 5 Jan 2014 22:18:42 -0800 Subject: [PATCH] Fixes putalpha tests Make sure we clear the pyaccess object each time we reset the self.im object --- PIL/Image.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PIL/Image.py b/PIL/Image.py index 2e353dd47..254b5b9c4 100644 --- a/PIL/Image.py +++ b/PIL/Image.py @@ -504,6 +504,7 @@ class Image: def _copy(self): self.load() self.im = self.im.copy() + self.pyaccess = None self.readonly = 0 def _dump(self, file=None, format=None): @@ -1205,12 +1206,14 @@ class Image: mode = getmodebase(self.mode) + "A" try: self.im.setmode(mode) + self.pyaccess = None except (AttributeError, ValueError): # do things the hard way im = self.im.convert(mode) if im.mode not in ("LA", "RGBA"): raise ValueError # sanity check self.im = im + self.pyaccess = None self.mode = self.im.mode except (KeyError, ValueError): raise ValueError("illegal image mode") @@ -1616,6 +1619,7 @@ class Image: self.size = size self.readonly = 0 + self.pyaccess = None # FIXME: the different tranform methods need further explanation # instead of bloating the method docs, add a separate chapter.