From: Bert Vermeulen Date: Wed, 18 Jan 2012 23:00:02 +0000 (+0100) Subject: accept only supported types in decoder class default option values X-Git-Tag: libsigrokdecode-0.1.0~123 X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=commitdiff_plain;h=130ef08ad86df267f14901a895ffd5ee46696c72 accept only supported types in decoder class default option values --- diff --git a/controller.c b/controller.c index f5e272e..ebda088 100644 --- a/controller.c +++ b/controller.c @@ -204,6 +204,10 @@ int srd_instance_set_options(struct srd_decoder_instance *di, goto err_out; if (!(py_classval = PyList_GetItem(py_optlist, 1))) goto err_out; + if (!PyUnicode_Check(py_classval) && !PyLong_Check(py_classval)) { + srd_err("Options of type %s are not yet supported.", Py_TYPE(py_classval)->tp_name); + goto err_out; + } if ((value = g_hash_table_lookup(options, key))) { /* An override for this option was provided. */