diff --git a/ChangeLog b/ChangeLog index 5500cfdd..6af08424 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-07-09 Daniele Varrazzo + + * psycopg/cursor_type.c: executemany() propagates exceptions raised by the + iterable to the caller. + 2010-05-20 Daniele Varrazzo * psycopg/typecast_datetime.c: Round seconds in historical timezones to diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 17d19721..9e874858 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -534,8 +534,13 @@ psyco_curs_executemany(cursorObject *self, PyObject *args, PyObject *kwargs) Py_XDECREF(iter); self->rowcount = rowcount; - Py_INCREF(Py_None); - return Py_None; + if (!PyErr_Occurred()) { + Py_INCREF(Py_None); + return Py_None; + } + else { + return NULL; + } }