+ /* Convert binary class to GSList of char *. */
+ d->binary = NULL;
+ if (PyObject_HasAttrString(d->py_dec, "binary")) {
+ py_bin_classes = PyObject_GetAttrString(d->py_dec, "binary");
+ if (!PyTuple_Check(py_bin_classes)) {
+ srd_err("Protocol decoder module %s binary classes "
+ "should be a tuple.", module_name);
+ goto err_out;
+ }
+ len = PyTuple_Size(py_bin_classes);
+ for (i = 0; i < len; i++) {
+ py_bin_class = PyTuple_GetItem(py_bin_classes, i);
+ if (!PyUnicode_Check(py_bin_class)) {
+ srd_err("Protocol decoder module %s binary "
+ "class should be a string.", module_name);
+ goto err_out;
+ }
+
+ if (py_str_as_str(py_bin_class, &bin) != SRD_OK) {
+ goto err_out;
+ }
+ d->binary = g_slist_append(d->binary, bin);
+ }
+ }
+