Skip to content

Commit 56070db

Browse files
committed
Avoid race conditions in binding sockets in tests
1 parent db6b99e commit 56070db

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

graalpython/lib-python/3/test/support/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,9 @@ def bind_port(sock, host=HOST):
783783
if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'):
784784
sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
785785

786-
# XXX GraalVM change: bind to a specific port
787-
# Our bind with port 0 doesn't know the real port until listen() is called
788-
# sock.bind((host, 0))
789-
sock.bind((host, 8756))
786+
sock.bind((host, 0))
787+
# XXX GraalVM change: our bind with port 0 doesn't know the real port until listen() is called
788+
sock.listen()
790789
port = sock.getsockname()[1]
791790
return port
792791

0 commit comments

Comments
 (0)