From: Bert Vermeulen Date: Sat, 7 Jan 2012 02:42:26 +0000 (+0100) Subject: check before calling PyObject_GetAttrString(): this throws an exception. X-Git-Tag: libsigrokdecode-0.1.0~200 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f9afa08467a7a11317f0e40145091a5945a54eda;p=libsigrokdecode.git check before calling PyObject_GetAttrString(): this throws an exception. --- diff --git a/decoder.c b/decoder.c index b590916..f06d5e9 100644 --- a/decoder.c +++ b/decoder.c @@ -134,7 +134,8 @@ int srd_load_decoder(const char *name, struct srd_decoder **dec) /* Convert class annotation attribute to GSList of **char */ d->annotation = NULL; - if ((py_annlist = PyObject_GetAttrString(py_res, "annotation"))) { + if (PyObject_HasAttrString(py_res, "annotation")) { + py_annlist = PyObject_GetAttrString(py_res, "annotation"); if (!PyList_Check(py_annlist)) { srd_err("Protocol decoder module %s annotation should be a list", name); return SRD_ERR_PYTHON;