Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit41bf7cc

Browse files
committed
FIX: be careful about communicating with subprocess
On windows on py312 we can not use `.communicate` during process shutdownbecause it internally uses Python threads which can no longer be created duringinterpreter shutdown.Closes#27437
1 parent1defb57 commit41bf7cc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎lib/matplotlib/backends/backend_pgf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ def _setup_latex_process(self, *, expect_reply=True):
257257
# Open LaTeX process for real work; register it for deletion. On
258258
# Windows, we must ensure that the subprocess has quit before being
259259
# able to delete the tmpdir in which it runs; in order to do so, we
260-
# must first `kill()` it, and then `communicate()` with it.
260+
# must first `kill()` it, and then `communicate()` with or `wait()` on
261+
# it.
261262
try:
262263
self.latex=subprocess.Popen(
263264
[mpl.rcParams["pgf.texsystem"],"-halt-on-error"],
@@ -274,7 +275,10 @@ def _setup_latex_process(self, *, expect_reply=True):
274275

275276
deffinalize_latex(latex):
276277
latex.kill()
277-
latex.communicate()
278+
try:
279+
latex.communicate()
280+
exceptRuntimeError:
281+
latex.wait()
278282

279283
self._finalize_latex=weakref.finalize(
280284
self,finalize_latex,self.latex)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp