Skip to content

Commit 1958a7a

Browse files
committed
fix: apply comments
Signed-off-by: yihong0618 <[email protected]>
1 parent 294e404 commit 1958a7a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Lib/test/test_atexit.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,17 @@ def callback():
209209
_testcapi.set_nomemory(0)
210210
""")
211211

212-
with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as f:
212+
with tempfile.NamedTemporaryFile(mode='w', suffix='.py') as f:
213213
f.write(code)
214+
f.flush()
214215
script = f.name
215216

216-
try:
217217
with SuppressCrashReport():
218218
with script_helper.spawn_python(script,
219219
stderr=subprocess.PIPE) as proc:
220220
proc.wait()
221221
stdout = proc.stdout.read()
222222
stderr = proc.stderr.read()
223-
finally:
224-
os.unlink(script)
225223

226224
self.assertIn(proc.returncode, (0, 1))
227225
self.assertNotIn(b"hello", stdout)

0 commit comments

Comments
 (0)