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

Skip to content

Commit 8851ec2

Browse files
committed
Fixed another case of filehandle leakage in pdf backend.
svn path=/trunk/matplotlib/; revision=3046
1 parent 877d3e4 commit 8851ec2

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
@@ -457,7 +457,9 @@ def writeFonts(self):
457457
self.writeObject(self.fontObject, fonts)
458458

459459
def _write_afm_font(self, filename):
460-
font = AFM(file(filename))
460+
fh = file(filename)
461+
font = AFM(fh)
462+
fh.close()
461463
fontname = font.get_fontname()
462464
fontdict = { 'Type': Name('Font'),
463465
'Subtype': Name('Type1'),

0 commit comments

Comments
 (0)