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

Skip to content

Commit b0259b3

Browse files
committed
Close files opened during testing
1 parent d5403fb commit b0259b3

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def set_font(self, fontname, fontsize, store=1):
284284
if (fontname,fontsize) != (self.fontname,self.fontsize):
285285
out = ("/%s findfont\n"
286286
"%1.3f scalefont\n"
287-
"setfont\n" % (fontname.decode('ascii'), fontsize))
287+
"setfont\n" % (fontname, fontsize))
288288

289289
self._pswriter.write(out)
290290
if store: self.fontname = fontname

lib/matplotlib/testing/decorators.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ def find_dotted_module(module_name, path=None):
271271
"""A version of imp which can handle dots in the module name"""
272272
res = None
273273
for sub_mod in module_name.split('.'):
274-
res = _, path, _ = imp.find_module(sub_mod, path)
274+
res = file, path, _ = imp.find_module(sub_mod, path)
275275
path = [path]
276+
if file is not None:
277+
file.close()
276278
return res
277279

278280
mod_file = find_dotted_module(func.__module__)[1]

lib/matplotlib/textpath.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,9 @@ def _get_char_id(self, font, ccode):
6363
"""
6464
sfnt = font.get_sfnt()
6565
try:
66-
ps_name = sfnt[(1, 0, 0, 6)]
66+
ps_name = sfnt[(1, 0, 0, 6)].decode('ascii')
6767
except KeyError:
68-
ps_name = sfnt[(3, 1, 0x0409, 6)].decode(
69-
'utf-16be').encode('ascii', 'replace')
68+
ps_name = sfnt[(3, 1, 0x0409, 6)].decode('utf-16be')
7069
char_id = urllib.quote('%s-%x' % (ps_name, ccode))
7170
return char_id
7271

0 commit comments

Comments
 (0)