]> sigrok.org Git - libsigrokdecode.git/blobdiff - controller.c
srd: decoder class structure check belongs in module loader
[libsigrokdecode.git] / controller.c
index f5e272edea49b8c1d5b17bee1502456ec7f9e61a..fa67004b22caf0b35e3014ea22d52eeac3c51101 100644 (file)
@@ -186,11 +186,6 @@ int srd_instance_set_options(struct srd_decoder_instance *di,
        py_dec_options = py_dec_optkeys = py_di_options = py_optval = NULL;
        py_optlist = py_classval = NULL;
        py_dec_options = PyObject_GetAttrString(di->decoder->py_dec, "options");
-       if (!PyDict_Check(py_dec_options)) {
-               srd_err("Protocol decoder %s options is not a dictionary.",
-                               di->decoder->name);
-               goto err_out;
-       }
 
        /* All of these are synthesized objects, so they're good. */
        py_dec_optkeys = PyDict_Keys(py_dec_options);
@@ -204,6 +199,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. */