From 270fe408319ad575092efca0dcdebab9ecdba70c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 3 Jan 2011 14:30:43 +0000 Subject: test_tkinter: use a context manager to close directly the pipe Patch written by Nadeem Vawda --- Lib/tkinter/test/test_tkinter/test_loadtk.py | 3 ++- Misc/ACKS | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/tkinter/test/test_tkinter/test_loadtk.py b/Lib/tkinter/test/test_tkinter/test_loadtk.py index 8f1a085..bab7bcd 100644 --- a/Lib/tkinter/test/test_tkinter/test_loadtk.py +++ b/Lib/tkinter/test/test_tkinter/test_loadtk.py @@ -31,7 +31,8 @@ class TkLoadTest(unittest.TestCase): # doesn't actually carry through to the process level # because they don't support unsetenv # If that's the case, abort. - display = os.popen('echo $DISPLAY').read().strip() + with os.popen('echo $DISPLAY') as pipe: + display = pipe.read().strip() if display: return diff --git a/Misc/ACKS b/Misc/ACKS index 6a3a25b..dccb779 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -866,6 +866,7 @@ Andrew Vant Atul Varma Dmitry Vasiliev Alexandre Vassalotti +Nadeem Vawda Frank Vercruesse Mike Verdone Jaap Vermeulen -- cgit v0.12