summaryrefslogtreecommitdiff
path: root/type_decoder.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2015-12-23 20:00:45 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2015-12-24 02:28:55 +0100
commit2824e81140d3a8e37464f758cf67f50f2f7afca7 (patch)
tree10b54864ae16f2d9233e2d799bad08481e481792 /type_decoder.c
parent0679f5bf9b2334deb75243abb80ef7e0d0472c18 (diff)
downloadlibsigrokdecode-2824e81140d3a8e37464f758cf67f50f2f7afca7.tar.gz
libsigrokdecode-2824e81140d3a8e37464f758cf67f50f2f7afca7.zip
Use a Python list (not tuple) for OUT_BINARY.
This is more consistent with annotation syntax and looks slightly better in most cases.
Diffstat (limited to 'type_decoder.c')
-rw-r--r--type_decoder.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/type_decoder.c b/type_decoder.c
index ae6b95f..228cd44 100644
--- a/type_decoder.c
+++ b/type_decoder.c
@@ -111,25 +111,25 @@ static int convert_binary(struct srd_decoder_inst *di, PyObject *obj,
int bin_class;
char *class_name, *buf;
- /* Should be a tuple of (binary class, bytes). */
- if (!PyTuple_Check(obj)) {
- srd_err("Protocol decoder %s submitted non-tuple for SRD_OUTPUT_BINARY.",
+ /* Should be a list of [binary class, bytes]. */
+ if (!PyList_Check(obj)) {
+ srd_err("Protocol decoder %s submitted non-list for SRD_OUTPUT_BINARY.",
di->decoder->name);
return SRD_ERR_PYTHON;
}
/* Should have 2 elements. */
- if (PyTuple_Size(obj) != 2) {
- srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY tuple "
+ if (PyList_Size(obj) != 2) {
+ srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY list "
"with %zd elements instead of 2", di->decoder->name,
PyList_Size(obj));
return SRD_ERR_PYTHON;
}
/* The first element should be an integer. */
- py_tmp = PyTuple_GetItem(obj, 0);
+ py_tmp = PyList_GetItem(obj, 0);
if (!PyLong_Check(py_tmp)) {
- srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY tuple, "
+ srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY list, "
"but first element was not an integer.", di->decoder->name);
return SRD_ERR_PYTHON;
}
@@ -141,9 +141,9 @@ static int convert_binary(struct srd_decoder_inst *di, PyObject *obj,
}
/* Second element should be bytes. */
- py_tmp = PyTuple_GetItem(obj, 1);
+ py_tmp = PyList_GetItem(obj, 1);
if (!PyBytes_Check(py_tmp)) {
- srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY tuple, "
+ srd_err("Protocol decoder %s submitted SRD_OUTPUT_BINARY list, "
"but second element was not bytes.", di->decoder->name);
return SRD_ERR_PYTHON;
}