]> granicus.if.org Git - python/commitdiff
Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 11 Mar 2011 19:57:11 +0000 (20:57 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 11 Mar 2011 19:57:11 +0000 (20:57 +0100)
Misc/NEWS
Tools/ccbench/ccbench.py

index 727816135507240465cfc349b07b5c3b31cdfd61..6704f722cfce705c08b913e5928a6afa7b780cbb 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -81,6 +81,11 @@ Build
 - Issue #11268: Prevent Mac OS X Installer failure if Documentation
   package had previously been installed.
 
+Tools/Demos
+-----------
+
+- Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
+
 Tests
 -----
 
index 02b192f487778ba1cc6a465d613c339554afe365..9f7118f8e9704b97855a7db636094bb59600e40c 100644 (file)
@@ -276,7 +276,8 @@ def _recv(sock, n):
     return sock.recv(n).decode('ascii')
 
 def latency_client(addr, nb_pings, interval):
-    with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
+    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+    try:
         _time = time.time
         _sleep = time.sleep
         def _ping():
@@ -289,6 +290,8 @@ def latency_client(addr, nb_pings, interval):
             _sleep(interval)
             _ping()
         _sendto(sock, LAT_END + "\n", addr)
+    finally:
+        sock.close()
 
 def run_latency_client(**kwargs):
     cmd_line = [sys.executable, '-E', os.path.abspath(__file__)]