]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-95243: Mitigate the race condition in testSockName (GH-96173)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 25 Aug 2022 02:03:29 +0000 (19:03 -0700)
committerGitHub <noreply@github.com>
Thu, 25 Aug 2022 02:03:29 +0000 (19:03 -0700)
commit915ee9ed43b199de6f9fb371c2224ef4593522ab
treebf5d7fb418bc471f54d516846e8a0a02eb24fbc9
parentd02e8fbc5a4a9f43ceaacb32dee84f8f661a12d2
gh-95243: Mitigate the race condition in testSockName (GH-96173)

find_unused_port() has an inherent race condition, but we can't use
bind_port() as that uses .getsockname() which this test is exercising.

Try binding to unused ports a few times before failing.

Signed-off-by: Ross Burton <ross.burton@arm.com>
(cherry picked from commit df110126971d0271a977ce10779083b3e335b4da)

Co-authored-by: Ross Burton <ross.burton@arm.com>
Lib/test/test_socket.py
Misc/NEWS.d/next/Tests/2022-08-22-14-59-42.gh-issue-95243.DeD66V.rst [new file with mode: 0644]