-/** @cond PRIVATE */
-SRD_PRIV PyTypeObject srd_Decoder_type = {
- PyVarObject_HEAD_INIT(NULL, 0)
- .tp_name = "sigrokdecode.Decoder",
- .tp_basicsize = sizeof(srd_Decoder),
- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = "sigrok Decoder base class",
- .tp_methods = Decoder_methods,
-};
-/** @endcond */
+/** Create the sigrokdecode.Decoder type.
+ * @return The new type object.
+ * @private
+ */
+SRD_PRIV PyObject *srd_Decoder_type_new(void)
+{
+ PyType_Spec spec;
+ PyType_Slot slots[] = {
+ { Py_tp_doc, "sigrok Decoder base class" },
+ { Py_tp_methods, Decoder_methods },
+ { Py_tp_new, (void *)&PyType_GenericNew },
+ { 0, NULL }
+ };
+ spec.name = "sigrokdecode.Decoder";
+ spec.basicsize = sizeof(srd_Decoder);
+ spec.itemsize = 0;
+ spec.flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE;
+ spec.slots = slots;
+
+ return PyType_FromSpec(&spec);
+}