Replaced PyObject_CallFunction() with *ObjArgs() where more efficient.

This commit is contained in:
Daniele Varrazzo 2010-11-09 01:49:22 +00:00
parent 9fe0511711
commit 422fede38e
8 changed files with 11 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2010-11-09 Daniele Varrazzo <daniele.varrazzo@gmail.com>
* Replaced PyObject_CallFunction() with *ObjArgs() where more efficient.
2010-11-08 Daniele Varrazzo <daniele.varrazzo@gmail.com> 2010-11-08 Daniele Varrazzo <daniele.varrazzo@gmail.com>
* psycopg/microprotocols.c: use faster function to build tuples. * psycopg/microprotocols.c: use faster function to build tuples.

View File

@ -241,5 +241,5 @@ psyco_AsIs(PyObject *module, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
return PyObject_CallFunction((PyObject *)&asisType, "O", obj); return PyObject_CallFunctionObjArgs((PyObject *)&asisType, obj, NULL);
} }

View File

@ -325,5 +325,5 @@ psyco_Binary(PyObject *module, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &str)) if (!PyArg_ParseTuple(args, "O", &str))
return NULL; return NULL;
return PyObject_CallFunction((PyObject *)&binaryType, "O", str); return PyObject_CallFunctionObjArgs((PyObject *)&binaryType, str, NULL);
} }

View File

@ -254,5 +254,5 @@ psyco_Boolean(PyObject *module, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
return PyObject_CallFunction((PyObject *)&pbooleanType, "O", obj); return PyObject_CallFunctionObjArgs((PyObject *)&pbooleanType, obj, NULL);
} }

View File

@ -276,5 +276,5 @@ psyco_Decimal(PyObject *module, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
return PyObject_CallFunction((PyObject *)&pdecimalType, "O", obj); return PyObject_CallFunctionObjArgs((PyObject *)&pdecimalType, obj, NULL);
} }

View File

@ -246,5 +246,5 @@ psyco_Float(PyObject *module, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &obj)) if (!PyArg_ParseTuple(args, "O", &obj))
return NULL; return NULL;
return PyObject_CallFunction((PyObject *)&pfloatType, "O", obj); return PyObject_CallFunctionObjArgs((PyObject *)&pfloatType, obj, NULL);
} }

View File

@ -91,7 +91,7 @@ psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *keywds)
if (name) if (name)
obj = PyObject_CallFunction(factory, "Os", self, name); obj = PyObject_CallFunction(factory, "Os", self, name);
else else
obj = PyObject_CallFunction(factory, "O", self); obj = PyObject_CallFunctionObjArgs(factory, self, NULL);
if (obj == NULL) return NULL; if (obj == NULL) return NULL;
if (PyObject_IsInstance(obj, (PyObject *)&cursorType) == 0) { if (PyObject_IsInstance(obj, (PyObject *)&cursorType) == 0) {

View File

@ -726,7 +726,7 @@ _psyco_curs_buildrow_with_factory(cursorObject *self, int row)
PyObject *res; PyObject *res;
n = PQnfields(self->pgres); n = PQnfields(self->pgres);
if ((res = PyObject_CallFunction(self->tuple_factory, "O", self))== NULL) if (!(res = PyObject_CallFunctionObjArgs(self->tuple_factory, self, NULL)))
return NULL; return NULL;
return _psyco_curs_buildrow_fill(self, res, row, n, 0); return _psyco_curs_buildrow_fill(self, res, row, n, 0);