From: David Howells Date: Fri, 11 Apr 2014 12:24:06 +0000 (+0100) Subject: C can't just return exception classes to python to raise an exception X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=660d8870d34c74f2fc9630432cc4c771efd15197;p=users%2Fdhowells%2Fkafs-utils.git C can't just return exception classes to python to raise an exception 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 --- diff --git a/py_rxconn.c b/py_rxconn.c index 309cbb7..604eb18 100644 --- a/py_rxconn.c +++ b/py_rxconn.c @@ -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);