Use the deferred error to provide a logical exception on access to a closed image

This commit is contained in:
wiredfool 2014-04-08 23:43:13 -07:00
parent b27ef76468
commit 3d352329f4

View File

@ -92,7 +92,7 @@ except ImportError:
from PIL import ImageMode
from PIL._binary import i8, o8
from PIL._util import isPath, isStringType
from PIL._util import isPath, isStringType, deferred_error
import os, sys
@ -513,7 +513,10 @@ class Image:
if Image.DEBUG:
print ("Error closing: %s" %msg)
self.im = None
# Instead of simply setting to None, we're setting up a
# deferred error that will better explain that the core image
# object is gone.
self.im = deferred_error(ValueError("Operation on closed image"))
def _copy(self):