diff options
-rw-r--r-- | gobject/gobjectmodule.c | 5 | ||||
-rw-r--r-- | gobject/pygmaincontext.c | 16 | ||||
-rw-r--r-- | gobject/pygmainloop.c | 7 | ||||
-rw-r--r-- | gobject/pygobject.c | 6 | ||||
-rw-r--r-- | gobject/pygparamspec.c | 4 | ||||
-rw-r--r-- | gobject/pygtype.c | 4 |
6 files changed, 9 insertions, 33 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index af6e31f..b86e2b8 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -1434,14 +1434,11 @@ static PyObject * pyg_source_remove(PyObject *self, PyObject *args) { guint tag; - PyObject *ret; if (!PyArg_ParseTuple(args, "i:source_remove", &tag)) return NULL; - ret = g_source_remove(tag) ? Py_True : Py_False; - Py_INCREF(ret); - return ret; + return PyBool_FromLong(g_source_remove(tag)); } static PyObject * diff --git a/gobject/pygmaincontext.c b/gobject/pygmaincontext.c index ee803c8..a3c25f1 100644 --- a/gobject/pygmaincontext.c +++ b/gobject/pygmaincontext.c @@ -44,31 +44,23 @@ pyg_main_context_compare(PyGMainContext *self, PyGMainContext *v) static PyObject * _wrap_g_main_context_iteration (PyGMainContext *self, PyObject *args) { - PyObject *py_ret; - gboolean may_block = TRUE; + gboolean ret, may_block = TRUE; if (!PyArg_ParseTuple(args, "|b:GMainContext.iteration", &may_block)) return NULL; Py_BEGIN_ALLOW_THREADS; - py_ret = g_main_context_iteration(self->context, may_block) - ? Py_True : Py_False; + ret = g_main_context_iteration(self->context, may_block); Py_END_ALLOW_THREADS; - Py_INCREF(py_ret); - return py_ret; + return PyBool_FromLong(ret); } static PyObject * _wrap_g_main_context_pending (PyGMainContext *self) { - PyObject *py_ret; - - py_ret = g_main_context_pending(self->context) ? Py_True : Py_False; - - Py_INCREF(py_ret); - return py_ret; + return PyBool_FromLong(g_main_context_pending(self->context)); } static PyMethodDef _PyGMainContext_methods[] = { diff --git a/gobject/pygmainloop.c b/gobject/pygmainloop.c index 1a7e163..5bd8487 100644 --- a/gobject/pygmainloop.c +++ b/gobject/pygmainloop.c @@ -85,12 +85,7 @@ _wrap_g_main_loop_get_context (PyGMainLoop *loop) static PyObject * _wrap_g_main_loop_is_running (PyGMainLoop *self) { - PyObject *py_ret; - - py_ret = g_main_loop_is_running(self->loop) ? Py_True : Py_False; - Py_INCREF(py_ret); - return py_ret; - + return PyBool_FromLong(g_main_loop_is_running(self->loop)); } static PyObject * diff --git a/gobject/pygobject.c b/gobject/pygobject.c index b8073cf..ac51daf 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -953,15 +953,11 @@ static PyObject * pygobject_handler_is_connected(PyGObject *self, PyObject *args) { guint handler_id; - PyObject *ret; if (!PyArg_ParseTuple(args, "i:GObject.handler_is_connected", &handler_id)) return NULL; - ret = g_signal_handler_is_connected(self->obj, handler_id) - ? Py_True : Py_False; - Py_INCREF(ret); - return ret; + return PyBool_FromLong(g_signal_handler_is_connected(self->obj, handler_id)); } static PyObject * diff --git a/gobject/pygparamspec.c b/gobject/pygparamspec.c index 530bb3c..fa4f558 100644 --- a/gobject/pygparamspec.c +++ b/gobject/pygparamspec.c @@ -111,9 +111,7 @@ pyg_param_spec_getattr(PyGParamSpec *self, const gchar *attr) } else if (G_IS_PARAM_SPEC_UCHAR(pspec)) { return PyString_FromFormat("%c", G_PARAM_SPEC_UCHAR(pspec)->default_value); } else if (G_IS_PARAM_SPEC_BOOLEAN(pspec)) { - PyObject *retval = G_PARAM_SPEC_BOOLEAN(pspec)->default_value ? Py_True : Py_False; - Py_INCREF(retval); - return retval; + return PyBool_FromLong(G_PARAM_SPEC_BOOLEAN(pspec)->default_value); } else if (G_IS_PARAM_SPEC_INT(pspec)) { return PyInt_FromLong(G_PARAM_SPEC_INT(pspec)->default_value); } else if (G_IS_PARAM_SPEC_UINT(pspec)) { diff --git a/gobject/pygtype.c b/gobject/pygtype.c index 404370c..3a23bb7 100644 --- a/gobject/pygtype.c +++ b/gobject/pygtype.c @@ -606,9 +606,7 @@ pyg_value_as_pyobject(const GValue *value, gboolean copy_boxed) return PyString_FromStringAndSize((char *)&val, 1); } case G_TYPE_BOOLEAN: { - PyObject *val = g_value_get_boolean(value) ? Py_True : Py_False; - Py_INCREF(val); - return val; + return PyBool_FromLong(g_value_get_boolean(value)); } case G_TYPE_INT: return PyInt_FromLong(g_value_get_int(value)); |