Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix error handling for non-blocking ``connect`` calls which meant
:meth:`socket.socket.connect` was sometimes raising a :exc:`BlockingIOError`
instead of waiting when a connection could not be immediately completed.
3 changes: 2 additions & 1 deletion Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3671,7 +3671,8 @@ internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen,
wait_connect = (s->sock_timeout != 0 && IS_SELECTABLE(s));
}
else {
wait_connect = (s->sock_timeout > 0 && err == SOCK_INPROGRESS_ERR
wait_connect = (s->sock_timeout > 0
&& (err == EAGAIN || err == SOCK_INPROGRESS_ERR)
&& IS_SELECTABLE(s));
}

Expand Down
Loading