[Python-checkins] cpython: socket.sendto(): exit directly after setting the error

victor.stinner python-checkins at python.org
Thu May 26 14:07:54 CEST 2011


http://hg.python.org/cpython/rev/9d33770071b2
changeset:   70399:9d33770071b2
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu May 26 14:05:59 2011 +0200
summary:
  socket.sendto(): exit directly after setting the error

Dummy change to avoid a false positive with the Clang Static Analyzer.

files:
  Modules/socketmodule.c |  9 +++++----
  1 files changed, 5 insertions(+), 4 deletions(-)


diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2782,6 +2782,7 @@
             PyErr_Format(PyExc_TypeError,
                          "sendto() takes 2 or 3 arguments (%d given)",
                          arglen);
+            return NULL;
     }
     if (PyErr_Occurred())
         return NULL;
@@ -3144,7 +3145,7 @@
         }
         return PyErr_SetExcFromWindowsErr(PyExc_WindowsError, GetLastError());
     }
-    return PyUnicode_FromUnicode(buf, size);            
+    return PyUnicode_FromUnicode(buf, size);
 #else
     char buf[1024];
     int res;
@@ -4038,7 +4039,7 @@
 static PyObject *
 socket_getaddrinfo(PyObject *self, PyObject *args, PyObject* kwargs)
 {
-    static char* kwnames[] = {"host", "port", "family", "type", "proto", 
+    static char* kwnames[] = {"host", "port", "family", "type", "proto",
                               "flags", 0};
     struct addrinfo hints, *res;
     struct addrinfo *res0 = NULL;
@@ -4053,7 +4054,7 @@
 
     family = socktype = protocol = flags = 0;
     family = AF_UNSPEC;
-    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|iiii:getaddrinfo", 
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|iiii:getaddrinfo",
                           kwnames, &hobj, &pobj, &family, &socktype,
                           &protocol, &flags)) {
         return NULL;
@@ -4289,7 +4290,7 @@
     PyObject *list;
     int i;
     struct if_nameindex *ni;
-  
+
     ni = if_nameindex();
     if (ni == NULL) {
         PyErr_SetFromErrno(socket_error);

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


More information about the Python-checkins mailing list