Skip to content

Commit 270fe40

Browse files
author
Victor Stinner
committed
test_tkinter: use a context manager to close directly the pipe
Patch written by Nadeem Vawda
1 parent 5c85e3f commit 270fe40

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Lib/tkinter/test/test_tkinter/test_loadtk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ def testLoadTkFailure(self):
3131
# doesn't actually carry through to the process level
3232
# because they don't support unsetenv
3333
# If that's the case, abort.
34-
display = os.popen('echo $DISPLAY').read().strip()
34+
with os.popen('echo $DISPLAY') as pipe:
35+
display = pipe.read().strip()
3536
if display:
3637
return
3738

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ Andrew Vant
866866
Atul Varma
867867
Dmitry Vasiliev
868868
Alexandre Vassalotti
869+
Nadeem Vawda
869870
Frank Vercruesse
870871
Mike Verdone
871872
Jaap Vermeulen

0 commit comments

Comments
 (0)