]> granicus.if.org Git - python/commitdiff
test_tkinter: use a context manager to close directly the pipe
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 3 Jan 2011 14:30:43 +0000 (14:30 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 3 Jan 2011 14:30:43 +0000 (14:30 +0000)
Patch written by Nadeem Vawda

Lib/tkinter/test/test_tkinter/test_loadtk.py
Misc/ACKS

index 8f1a085b6d6e99c77baf67ca041a0722c1f1b4f8..bab7bcd37ce31882f23cbc2437e90ee734706d2a 100644 (file)
@@ -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
 
index 6a3a25bd717cd5e28d685d8b5eb2b92d624faa37..dccb7790742b39ec7cea4f868bef9d7df7fd73da 100644 (file)
--- 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