diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-03-11 19:57:11 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-03-11 19:57:11 (GMT) |
commit | 375ff587c2c4a1ba228bdf9a9fb78d9b8f674347 (patch) | |
tree | 4b2a3b4efa9e712da2112f2d355b8b9b066414aa /Tools | |
parent | 147f6088f0279d79cb934816ca63e5fa216b34ce (diff) | |
download | cpython-375ff587c2c4a1ba228bdf9a9fb78d9b8f674347.zip cpython-375ff587c2c4a1ba228bdf9a9fb78d9b8f674347.tar.gz cpython-375ff587c2c4a1ba228bdf9a9fb78d9b8f674347.tar.bz2 |
Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/ccbench/ccbench.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Tools/ccbench/ccbench.py b/Tools/ccbench/ccbench.py index 02b192f..9f7118f 100644 --- a/Tools/ccbench/ccbench.py +++ b/Tools/ccbench/ccbench.py @@ -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__)] |