Closes #1375: fix ResourceWarnings with unclosed PIL images.

This commit is contained in:
Georg Brandl
2014-03-01 09:08:58 +01:00
parent 55e2f29170
commit 048b7d77d3

View File

@@ -402,7 +402,10 @@ class HTMLTranslator(BaseTranslator):
node['width'] = str(im.size[0])
if not node.has_key('height'):
node['height'] = str(im.size[1])
del im
try:
im.fp.close()
except Exception:
pass
BaseTranslator.visit_image(self, node)
def visit_toctree(self, node):