[Python-checkins] cpython: Issue #23618: Fix sock_connect_impl(), set the socket error code

victor.stinner python-checkins at python.org
Thu Apr 2 14:38:11 CEST 2015


https://hg.python.org/cpython/rev/44adbb5eeb4b
changeset:   95381:44adbb5eeb4b
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Apr 02 14:37:20 2015 +0200
summary:
  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.

files:
  Modules/socketmodule.c |  8 +++++++-
  1 files changed, 7 insertions(+), 1 deletions(-)


diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list