Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49cf089

Browse files
korliencukou
andauthored
Modules/socketmodule.c: better comment for internal_connect
Co-authored-by: Petr Viktorin <[email protected]>
1 parent 1af62db commit 49cf089

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

Modules/socketmodule.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3405,7 +3405,18 @@ sock_connect_impl(PySocketSockObject *s, void* Py_UNUSED(data))
34053405
return 1;
34063406
}
34073407

3408-
/* Returns 0 on success, -1 with exception set on failure, or error code if not. */
3408+
/* Common functionality for socket.connect and socket.connect_ex.
3409+
*
3410+
* If *raise* is set:
3411+
* - On success, return 0.
3412+
* - On any failure, return -1 with an exception set.
3413+
* If *raise* is zero:
3414+
* - On success, return 0.
3415+
* - On connect() failure, return errno (without an exception set)
3416+
* - On other error, return -1 with an exception set.
3417+
*
3418+
* Note that -1 is a valid errno value on some systems.
3419+
*/
34093420
static int
34103421
internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen,
34113422
int raise)

0 commit comments

Comments
 (0)