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

Skip to content

Commit 04536ea

Browse files
committed
Silence some more cloesed file warnings
1 parent bd67783 commit 04536ea

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/matplotlib/backends/backend_ps.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,13 @@ def gs_version(self):
9090
pass
9191

9292
from matplotlib.compat.subprocess import Popen, PIPE
93-
pipe = Popen(self.gs_exe + " --version",
94-
shell=True, stdout=PIPE).stdout
93+
s = Popen(self.gs_exe + " --version",
94+
shell=True, stdout=PIPE)
95+
pipe, stderr = s.communicate()
9596
if six.PY3:
96-
ver = pipe.read().decode('ascii')
97+
ver = pipe.decode('ascii')
9798
else:
98-
ver = pipe.read()
99+
ver = pipe
99100
gs_version = tuple(map(int, ver.strip().split(".")))
100101

101102
self._cached["gs_version"] = gs_version

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def _test_savefig_to_stringio(format='ps'):
4040

4141
assert values[0] == values[1]
4242
assert values[1] == values[2].replace(b'\r\n', b'\n')
43+
for buffer in buffers:
44+
buffer.close()
4345

4446

4547
@cleanup
@@ -80,4 +82,4 @@ def test_savefig_to_stringio_with_usetex_eps():
8082

8183
if __name__ == '__main__':
8284
import nose
83-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
85+
nose.runmodule(argv=['-s', '--with-doctest', '-verbose'], exit=False)

0 commit comments

Comments
 (0)