- if (!PyUnicode_Check(py_bin_class)) {
- srd_err("Protocol decoder module %s binary "
- "class should be a string.", module_name);
+ if (!PyTuple_Check(py_bin_class)) {
+ srd_err("Protocol decoder %s binary classes "
+ "should consist of tuples.", module_name);
+ goto err_out;
+ }
+ if (PyTuple_Size(py_bin_class) != 2
+ || !PyUnicode_Check(PyTuple_GetItem(py_bin_class, 0))
+ || !PyUnicode_Check(PyTuple_GetItem(py_bin_class, 1))) {
+ srd_err("Protocol decoder %s binary classes should "
+ "contain tuples with two strings.", module_name);