8000 MNT: if process dies, make sure we close the streams · matplotlib/matplotlib@6f16cb2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f16cb2

Browse files
committed
MNT: if process dies, make sure we close the streams
This prevents pytest from failing other test due to auto-closed resources.
1 parent 574580c commit 6f16cb2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/matplotlib/testing/compare.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ def __call__(self, orig, dest):
147147
weakref.finalize(self._tmpdir, self.__del__)
148148
if (not self._proc # First run.
149149
or self._proc.poll() is not None): # Inkscape terminated.
150+
if self._proc is not None and self._proc.poll() is not None:
151+
for stream in filter(None, [self._proc.stdin,
152+
self._proc.stdout,
153+
self._proc.stderr]):
154+
stream.close()
150155
env = {
151156
**os.environ,
152157
# If one passes e.g. a png file to Inkscape, it will try to

0 commit comments

Comments
 (0)
0