mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-10-13 17:02:12 -05:00
Closes #1375: fix ResourceWarnings with unclosed PIL images.
This commit is contained in:
1 parent
55e2f29170
commit
048b7d77d3
1 file changed
+4
-1
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user