diff --git a/ChangeLog b/ChangeLog index 604447a1..44279305 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-05-10 Federico Di Gregorio + * psycopg/cursor_ext.c: now raise correct exception when fetching + using a custom row factory results in an error. + * lib/extras.py: applied DictRow "diet" patch from Marko Kreen. 2009-04-21 Federico Di Gregorio diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index d4f0baa4..82e390bd 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -326,7 +326,7 @@ _psyco_curs_execute(cursorObject *self, /* Any failure from here forward should 'goto fail' rather than 'return 0' directly. */ - + if (operation == NULL) { goto fail; } IFCLEARPGRES(self->pgres); @@ -425,7 +425,7 @@ _psyco_curs_execute(cursorObject *self, } /* At this point, the SQL statement must be str, not unicode */ - + res = pq_execute(self, PyString_AS_STRING(self->query), async); Dprintf("psyco_curs_execute: res = %d, pgres = %p", res, self->pgres); if (res == -1) { goto fail; } @@ -713,8 +713,13 @@ _psyco_curs_buildrow_fill(cursorObject *self, PyObject *res, PyTuple_SET_ITEM(res, i, val); } else { - PySequence_SetItem(res, i, val); + int err = PySequence_SetItem(res, i, val); Py_DECREF(val); + if (err == -1) { + Py_DECREF(res); + res = NULL; + break; + } } } else { diff --git a/psycopg2.cproj b/psycopg2.cproj index 1e23a87f..23f5b350 100644 --- a/psycopg2.cproj +++ b/psycopg2.cproj @@ -7,7 +7,7 @@ 2.0 {CFD80D18-3EE5-49ED-992A-E6D433BC7641} - + C Bin @@ -17,11 +17,11 @@ . DEBUG MONODEVELOP - + Bin - + @@ -32,7 +32,7 @@ bin\Release MONODEVELOP - + 3 psycopg2 @@ -170,12 +170,12 @@ - + - +