summaryrefslogtreecommitdiff
path: root/gi/pygi-source.c
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-04-05 11:30:44 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-04-05 11:30:44 +0200
commit5f961b426b9bd25956e5364770c71c34c414d4e6 (patch)
tree0328b383b91ba4be1e22e3f636bcd689cee0573d /gi/pygi-source.c
parent8b55a207cdb8a1ec5c1cdcce48f69d292192f9b7 (diff)
downloadpygobject-5f961b426b9bd25956e5364770c71c34c414d4e6.tar.gz
build: use -Wconversion -Wno-sign-conversion. Fixes #191
In some cases changing the type used was enough, in some others I just force casted things as too many changes would be required and overflow unlikely (for array marshalling the cache uses gssize while the marshalling code uses garray and thus guint) My hope is that having this enabled will improve things gradually with future cleanups.
Diffstat (limited to 'gi/pygi-source.c')
-rw-r--r--gi/pygi-source.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/gi/pygi-source.c b/gi/pygi-source.c
index d09849f0..b49b7d58 100644
--- a/gi/pygi-source.c
+++ b/gi/pygi-source.c
@@ -27,6 +27,7 @@
#include "pygi-info.h"
#include "pygi-boxed.h"
#include "pygi-type.h"
+#include "pygi-basictype.h"
#include "pygboxed.h"
#include "pygi-source.h"
@@ -65,13 +66,16 @@ pyg_source_prepare(GSource *source, gint *timeout)
goto bail;
}
- ret = PyObject_IsTrue(PyTuple_GET_ITEM(t, 0));
- *timeout = PYGLIB_PyLong_AsLong(PyTuple_GET_ITEM(t, 1));
+ if (!pygi_gboolean_from_py (PyTuple_GET_ITEM(t, 0), &ret)) {
+ ret = FALSE;
+ goto bail;
+ }
- if (*timeout == -1 && PyErr_Occurred()) {
- ret = FALSE;
- goto bail;
- }
+ if (!pygi_gint_from_py (PyTuple_GET_ITEM(t, 1), timeout))
+ {
+ ret = FALSE;
+ goto bail;
+ }
got_err = FALSE;
@@ -229,7 +233,7 @@ PyObject *
pyg_source_set_callback(PyGObject *self_module, PyObject *args)
{
PyObject *self, *first, *callback, *cbargs = NULL, *data;
- gint len;
+ Py_ssize_t len;
len = PyTuple_Size (args);
if (len < 2) {