From d468a37a37b8f3693f2e051bdbe9b346b3770a94 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 13 Feb 2013 00:57:29 +0100 Subject: [PATCH] Give the Python binding a better chance to work --- src/python/libDatabase.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python/libDatabase.c b/src/python/libDatabase.c index 89218e7..9dc0149 100644 --- a/src/python/libDatabase.c +++ b/src/python/libDatabase.c @@ -101,11 +101,11 @@ static PyObject * _libdatabase_database_get_last_id(PyObject * self, Database * database; long long ret; + if(!PyArg_ParseTuple(args, "O", &self)) + return NULL; if((database = PyCapsule_GetPointer(self, _libdatabase_database_name)) == NULL) return NULL; - if(!PyArg_ParseTuple(args, "")) - return NULL; ret = database_get_last_id(database); return Py_BuildValue("L", ret); } @@ -118,11 +118,11 @@ static PyObject * _libdatabase_database_query(PyObject * self, PyObject * args) char const * query; int ret; + if(!PyArg_ParseTuple(args, "Os", &self, &query)) + return NULL; if((database = PyCapsule_GetPointer(self, _libdatabase_database_name)) == NULL) return NULL; - if(!PyArg_ParseTuple(args, "s", &query)) - return NULL; /* FIXME implement the callbacks one way or another */ ret = database_query(database, query, NULL, NULL); return Py_BuildValue("i", ret);