[3.13] gh-113892: Add a extra check to ProactorEventLoop.sock_connect to ensure that the given socket is in non-blocking mode (GH-119519) (#119912)

(cherry picked from commit cf3bba3f06)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
Miss Islington (bot) 2024-06-01 18:27:54 +02:00 committed by GitHub
parent 4e147caf3f
commit 0ea77d49cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View file

@ -721,6 +721,8 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
return await self._proactor.sendto(sock, data, 0, address)
async def sock_connect(self, sock, address):
if self._debug and sock.gettimeout() != 0:
raise ValueError("the socket must be non-blocking")
return await self._proactor.connect(sock, address)
async def sock_accept(self, sock):