diff options
Diffstat (limited to 'gi/pygi-type.h')
-rw-r--r-- | gi/pygi-type.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gi/pygi-type.h b/gi/pygi-type.h index 94ddc850..8032571d 100644 --- a/gi/pygi-type.h +++ b/gi/pygi-type.h @@ -28,10 +28,16 @@ #define PYGOBJECT_REGISTER_GTYPE(d, type, name, gtype) \ { \ - PyObject *o; \ - PYGLIB_REGISTER_TYPE(d, type, name); \ + PyObject *o; \ + if (!type.tp_alloc) \ + type.tp_alloc = PyType_GenericAlloc; \ + if (!type.tp_new) \ + type.tp_new = PyType_GenericNew; \ + if (PyType_Ready(&type)) \ + return -1; \ + PyDict_SetItemString(d, name, (PyObject *)&type); \ PyDict_SetItemString(type.tp_dict, "__gtype__", \ - o=pyg_type_wrapper_new(gtype)); \ + o=pyg_type_wrapper_new(gtype)); \ Py_DECREF(o); \ } |