[Python-checkins] (3.2): Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
antoine.pitrou
python-checkins at python.org
Fri Mar 11 20:58:40 CET 2011
http://hg.python.org/cpython/rev/353032fd38e2
changeset: 68381:353032fd38e2
branch: 3.2
parent: 68379:eeef2f17a774
user: Antoine Pitrou <solipsis at pitrou.net>
date: Fri Mar 11 20:57:11 2011 +0100
summary:
Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
files:
Misc/NEWS
Tools/ccbench/ccbench.py
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -81,6 +81,11 @@
- 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
-----
diff --git a/Tools/ccbench/ccbench.py b/Tools/ccbench/ccbench.py
--- a/Tools/ccbench/ccbench.py
+++ b/Tools/ccbench/ccbench.py
@@ -276,7 +276,8 @@
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 @@
_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__)]
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list