summaryrefslogtreecommitdiff
path: root/gi/pygboxed.c
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-03-24 17:34:23 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-03-24 17:34:23 +0100
commitbfc759c9c0bb2e90c461315dc852d5faa13f4363 (patch)
treee7f303613fb45f7b524bb863713abccd15815537 /gi/pygboxed.c
parent7607052e0547c6d45f4db9b56246c07194f02ca8 (diff)
downloadpygobject-bfc759c9c0bb2e90c461315dc852d5faa13f4363.tar.gz
Make sure that types are fully initialized when they are first used.
This asserts that PyType_Ready() was called on the types before using them to create instances or as base class for other types. With this PyPy no longer crashes when importing the _gi module.
Diffstat (limited to 'gi/pygboxed.c')
-rw-r--r--gi/pygboxed.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gi/pygboxed.c b/gi/pygboxed.c
index 65171694..1e8b0692 100644
--- a/gi/pygboxed.c
+++ b/gi/pygboxed.c
@@ -159,6 +159,7 @@ pyg_register_boxed(PyObject *dict, const gchar *class_name,
if (!type->tp_dealloc) type->tp_dealloc = (destructor)pyg_boxed_dealloc;
Py_TYPE(type) = &PyType_Type;
+ g_assert (Py_TYPE (&PyGBoxed_Type) != NULL);
type->tp_base = &PyGBoxed_Type;
if (PyType_Ready(type) < 0) {