Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 877d3e4

Browse files
committed
Fix a filehandle leak in pdf backend
svn path=/trunk/matplotlib/; revision=3045
1 parent 253848b commit 877d3e4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/matplotlib/backends/backend_pdf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,9 @@ def _get_font_afm(self, prop):
10811081
font = self.afm_font_cache.get(key)
10821082
if font is None:
10831083
filename = fontManager.findfont(prop, fontext='afm')
1084-
font = AFM(file(filename))
1084+
fh = file(filename)
1085+
font = AFM(fh)
1086+
fh.close()
10851087
self.afm_font_cache[key] = font
10861088
return font
10871089

0 commit comments

Comments
 (0)