Kaydet (Commit) c0fdf6cf authored tarafından Georg Brandl's avatar Georg Brandl

Closes #14421: use with statement to properly close socket in bandwidth test.

üst 1641bb76
...@@ -435,7 +435,7 @@ def run_bandwidth_client(**kwargs): ...@@ -435,7 +435,7 @@ def run_bandwidth_client(**kwargs):
def run_bandwidth_test(func, args, nthreads): def run_bandwidth_test(func, args, nthreads):
# Create a listening socket to receive the packets. We use UDP which should # Create a listening socket to receive the packets. We use UDP which should
# be painlessly cross-platform. # be painlessly cross-platform.
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
sock.bind(("127.0.0.1", 0)) sock.bind(("127.0.0.1", 0))
addr = sock.getsockname() addr = sock.getsockname()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment