Skip to content

Commit

Permalink
Cleaner handling of oid parameter in getlo() method
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Apr 29, 2017
1 parent 5466209 commit 58de6c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pgmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3099,21 +3099,23 @@ static char connGetLO__doc__[] =
static PyObject *
connGetLO(connObject *self, PyObject *args)
{
int lo_oid;
int oid;
Oid lo_oid;

/* checks validity */
if (!check_cnx_obj(self))
return NULL;

/* gets arguments */
if (!PyArg_ParseTuple(args, "i", &lo_oid))
if (!PyArg_ParseTuple(args, "i", &oid))
{
PyErr_SetString(PyExc_TypeError,
"Method getlo() takes an integer argument");
return NULL;
}

if (!lo_oid)
lo_oid = (Oid)oid;
if (lo_oid == 0)
{
PyErr_SetString(PyExc_ValueError, "The object oid can't be null");
return NULL;
Expand Down

0 comments on commit 58de6c7

Please sign in to comment.