summaryrefslogtreecommitdiff
path: root/gi/pygparamspec.c
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-03-23 16:03:02 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-03-23 16:03:02 +0100
commit7b65bc99cf8e399c9b468291b3e89f4c87f99f87 (patch)
tree59495bb0d4eb38cc5959342f26f34288877c7152 /gi/pygparamspec.c
parent9d1891d51968b7c5ac7928df0207c1b1e7800728 (diff)
downloadpygobject-7b65bc99cf8e399c9b468291b3e89f4c87f99f87.tar.gz
Add error handling to all type init function.
They were all just ignoring errors. Also change those functions to use the pygi prefix.
Diffstat (limited to 'gi/pygparamspec.c')
-rw-r--r--gi/pygparamspec.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gi/pygparamspec.c b/gi/pygparamspec.c
index 5ab2c5b5..ccb943ce 100644
--- a/gi/pygparamspec.c
+++ b/gi/pygparamspec.c
@@ -398,8 +398,11 @@ pyg_param_spec_new(GParamSpec *pspec)
return (PyObject *)self;
}
-void
-pygobject_paramspec_register_types(PyObject *d)
+/**
+ * Returns 0 on success, or -1 and sets an exception.
+ */
+int
+pygi_paramspec_register_types(PyObject *d)
{
Py_TYPE(&PyGParamSpec_Type) = &PyType_Type;
PyGParamSpec_Type.tp_dealloc = (destructor)pyg_param_spec_dealloc;
@@ -410,8 +413,9 @@ pygobject_paramspec_register_types(PyObject *d)
PyGParamSpec_Type.tp_hash = (hashfunc)pyg_param_spec_hash;
PyGParamSpec_Type.tp_methods = pyg_param_spec_methods;
-
if (PyType_Ready(&PyGParamSpec_Type))
- return;
+ return -1;
PyDict_SetItemString(d, "GParamSpec", (PyObject *)&PyGParamSpec_Type);
+
+ return 0;
}