Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #19811 on branch v3.4.x (Fix Inkscape cleanup at exit on Windows.) #19833

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/matplotlib/testing/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import subprocess
import sys
from tempfile import TemporaryDirectory, TemporaryFile
import weakref

import numpy as np
from PIL import Image
Expand Down Expand Up @@ -170,6 +171,9 @@ def __call__(self, orig, dest):
terminator = b"\n>" if old_inkscape else b"> "
if not hasattr(self, "_tmpdir"):
self._tmpdir = TemporaryDirectory()
# On Windows, we must make sure that self._proc has terminated
# (which __del__ does) before clearing _tmpdir.
weakref.finalize(self._tmpdir, self.__del__)
if (not self._proc # First run.
or self._proc.poll() is not None): # Inkscape terminated.
env = {
Expand Down