X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=decoder.c;h=71e9122181324fad0325314ddbf78eb75f2fc1a6;hb=888bbe38a50a1e3224dcef68686a00e2754e8b47;hp=ff6e7ac2746917476593c883c5b62b3473f23739;hpb=23a29d24b01a68acb11be55abfcbe8d3fb0cdeb2;p=libsigrokdecode.git diff --git a/decoder.c b/decoder.c index ff6e7ac..71e9122 100644 --- a/decoder.c +++ b/decoder.c @@ -366,6 +366,17 @@ SRD_API int srd_decoder_load(const char *module_name) } Py_CLEAR(py_basedec); + /* + * Check that thіs decoder has the correct PD API version. + * PDs of different API versions are incompatible and cannot work. + */ + py_long = PyObject_GetAttrString(d->py_dec, "api_version"); + if (PyLong_AsLong(py_long) != 2) { + srd_err("Only PDs of API version 2 are supported."); + goto err_out; + } + Py_CLEAR(py_long); + /* Check for a proper start() method. */ if (!PyObject_HasAttrString(d->py_dec, "start")) { srd_err("Protocol decoder %s has no start() method Decoder "