(original) (raw)

changeset: 95381:44adbb5eeb4b user: Victor Stinner victor.stinner@gmail.com date: Thu Apr 02 14:37:20 2015 +0200 files: Modules/socketmodule.c description: Issue #23618: Fix sock_connect_impl(), set the socket error code sock_call_ex() gets the socket error code when the socket function fails. sock_connect_impl() didn't set the error correctly. diff -r c4f8b56cb4e3 -r 44adbb5eeb4b Modules/socketmodule.c --- a/Modules/socketmodule.c Thu Apr 02 14:22:44 2015 +0200 +++ b/Modules/socketmodule.c Thu Apr 02 14:37:20 2015 +0200 @@ -2589,7 +2589,13 @@ if (err == EISCONN) return 1; - return (err == 0); + if (err != 0) { + /* sock_call_ex() uses GET_SOCK_ERROR() to get the error code */ + SET_SOCK_ERROR(err); + abort(); + return 0; + } + return 1; } static int /victor.stinner@gmail.com