This commit is contained in:
wiredfool 2014-03-27 22:17:27 -07:00
parent 86ab020736
commit b73b4a7b63

View File

@ -1,4 +1,5 @@
from tester import *
import warnings
from PIL import Image, TiffImagePlugin
@ -34,6 +35,7 @@ def test_g4_tiff():
assert_equal(im.size, (500,500))
_assert_noerr(im)
im = None
def test_g4_large():
file = "Tests/images/pport_g4.tif"
@ -295,3 +297,15 @@ def xtest_bw_compression_wRGB():
assert_exception(IOError, lambda: im.save(out, compression='group3'))
assert_exception(IOError, lambda: im.save(out, compression='group4'))
def test_fp_leak():
import os
im = Image.open("Tests/images/lena_g4_500.tif")
fn = im.fp.fileno()
assert_no_exception(lambda: os.fstat(fn))
im.load() # this should close it.
assert_exception(OSError, lambda: os.fstat(fn))
im = None # this should force even more closed.
assert_exception(OSError, lambda: os.fstat(fn))
assert_exception(OSError, lambda: os.close(fn))