10000 Close file so it hopefully works on windows (but not tested) · matplotlib/matplotlib@61661f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 61661f1

Browse files
committed
Close file so it hopefully works on windows (but not tested)
1 parent a59c268 commit 61661f1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/stubtest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def visit_ClassDef(self, node):
5252
self.visit(child)
5353

5454

55-
with tempfile.NamedTemporaryFile("wt") as f:
55+
with tempfile.NamedTemporaryFile("wt", delete=False) as f:
5656
for path in mpl.glob("**/*.py"):
5757
v = Visitor(path, f)
5858
tree = ast.parse(path.read_text())
@@ -64,6 +64,7 @@ def visit_ClassDef(self, node):
6464

6565
v.visit(tree)
6666
f.flush()
67+
f.close()
6768
proc = subprocess.run(
6869
[
6970
"stubtest",
@@ -75,5 +76,9 @@ def visit_ClassDef(self, node):
7576
cwd=root,
7677
env=os.environ | {"MPLBACKEND": "agg"},
7778
)
79+
try:
80+
os.unlink(f.name)
81+
except OSError:
82+
pass
7883< 3A20 /code>

7984
sys.exit(proc.returncode)

0 commit comments

Comments
 (0)
0