Avoid clobbering the exceptions raised by other calls

This commit is contained in:
Daniele Varrazzo 2014-06-05 01:25:22 +02:00
parent d558cc5cf8
commit e53c738fec

View File

@ -1054,8 +1054,6 @@ psyco_curs_callproc(cursorObject *self, PyObject *args)
if (using_dict) {
#if PG_VERSION_HEX >= 0x090000
if (!(pnames = PyDict_Keys(parameters))) {
PyErr_SetString(PyExc_RuntimeError,
"built-in 'keys' failed on a Dict!");
goto exit;
}
@ -1073,36 +1071,26 @@ psyco_curs_callproc(cursorObject *self, PyObject *args)
/* all errors are RuntimeErrors as they should never occur */
if (!(pname = PyList_GetItem(pnames, i))) {
PyErr_SetString(PyExc_RuntimeError,
"built-in 'values' did not return List!");
goto exit;
}
if (!(spname = PyObject_Str(pname))) {
PyErr_SetString(PyExc_RuntimeError,
"built-in 'str' failed!");
goto exit;
}
/* this is the only function here that returns a new reference */
if (!(bpname = psycopg_ensure_bytes(spname))) {
PyErr_SetString(PyExc_RuntimeError,
"failed to get Bytes from text!");
goto exit;
}
if (!(cpname = Bytes_AsString(bpname))) {
Py_XDECREF(bpname);
PyErr_SetString(PyExc_RuntimeError,
"failed to get cstr from Bytes!");
goto exit;
}
if (!(scpnames[i] = PQescapeIdentifier(self->conn->pgconn, cpname,
strlen(cpname)))) {
Py_XDECREF(bpname);
PyErr_SetString(PyExc_RuntimeError,
"libpq failed to escape identifier!");
goto exit;
}
@ -1126,8 +1114,6 @@ psyco_curs_callproc(cursorObject *self, PyObject *args)
sql[sl-1] = '\0';
if (!(parameters = PyDict_Values(parameters))) {
PyErr_SetString(PyExc_RuntimeError,
"built-in 'values' failed on a Dict!");
goto exit;
}
#else