]> www.infradead.org Git - users/dhowells/kafs-utils.git/commitdiff
C can't just return exception classes to python to raise an exception
authorDavid Howells <dhowells@redhat.com>
Fri, 11 Apr 2014 12:24:06 +0000 (13:24 +0100)
committerDavid Howells <dhowells@redhat.com>
Fri, 11 Apr 2014 12:24:29 +0000 (13:24 +0100)
C can't just return exception classes to python to raise an exception, it must
instead call something like PyErr_Format().

Signed-off-by: David Howells <dhowells@redhat.com>
py_rxconn.c

index 309cbb7f00389e8a9ce9a8a59def6e1b4831d012..604eb18674ae2735f206bfc527d0982ae285305c 100644 (file)
@@ -131,7 +131,8 @@ kafs_py_rx_new_connection(PyObject *_self, PyObject *args)
                sa.sin6.sin6_port = htons(port);
                salen = sizeof(sa.sin6);
        } else {
-               return PyExc_TypeError;
+               return PyErr_Format(PyExc_RuntimeError,
+                                   "Unsupported network address '%s'", address);
        }
 
        obj = (struct py_rx_connection *)_PyObject_New(&py_rx_connectionType);