+ /* Default to instance id, which defaults to class id. */
+ proto_id = di->inst_id;
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|s(Oss)", keywords,
+ &output_type, &proto_id,
+ &meta_type_py, &meta_name, &meta_descr)) {
+ /* Let Python raise this exception. */
+ return NULL;
+ }
+
+ /* Check if the meta value's type is supported. */
+ if (output_type == SRD_OUTPUT_META) {
+ if (meta_type_py == &PyLong_Type)
+ meta_type_gv = G_VARIANT_TYPE_INT64;
+ else if (meta_type_py == &PyFloat_Type)
+ meta_type_gv = G_VARIANT_TYPE_DOUBLE;
+ else {
+ PyErr_Format(PyExc_TypeError, "Unsupported type '%s'.",
+ meta_type_py->tp_name);
+ return NULL;
+ }
+ }
+
+ srd_dbg("Instance %s creating new output type %d for %s.",
+ di->inst_id, output_type, proto_id);
+
+ if (!(pdo = g_try_malloc(sizeof(struct srd_pd_output)))) {
+ PyErr_SetString(PyExc_MemoryError, "struct srd_pd_output");