mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-13 12:36:33 +03:00
Avoid clobbering the exceptions raised by other calls
This commit is contained in:
parent
c205f140a0
commit
04ce14b251
|
@ -1060,8 +1060,6 @@ psyco_curs_callproc(cursorObject *self, PyObject *args)
|
||||||
if (using_dict) {
|
if (using_dict) {
|
||||||
#if PG_VERSION_HEX >= 0x090000
|
#if PG_VERSION_HEX >= 0x090000
|
||||||
if (!(pnames = PyDict_Keys(parameters))) {
|
if (!(pnames = PyDict_Keys(parameters))) {
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
|
||||||
"built-in 'keys' failed on a Dict!");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1079,36 +1077,26 @@ psyco_curs_callproc(cursorObject *self, PyObject *args)
|
||||||
/* all errors are RuntimeErrors as they should never occur */
|
/* all errors are RuntimeErrors as they should never occur */
|
||||||
|
|
||||||
if (!(pname = PyList_GetItem(pnames, i))) {
|
if (!(pname = PyList_GetItem(pnames, i))) {
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
|
||||||
"built-in 'values' did not return List!");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(spname = PyObject_Str(pname))) {
|
if (!(spname = PyObject_Str(pname))) {
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
|
||||||
"built-in 'str' failed!");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this is the only function here that returns a new reference */
|
/* this is the only function here that returns a new reference */
|
||||||
if (!(bpname = psycopg_ensure_bytes(spname))) {
|
if (!(bpname = psycopg_ensure_bytes(spname))) {
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
|
||||||
"failed to get Bytes from text!");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cpname = Bytes_AsString(bpname))) {
|
if (!(cpname = Bytes_AsString(bpname))) {
|
||||||
Py_XDECREF(bpname);
|
Py_XDECREF(bpname);
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
|
||||||
"failed to get cstr from Bytes!");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(scpnames[i] = PQescapeIdentifier(self->conn->pgconn, cpname,
|
if (!(scpnames[i] = PQescapeIdentifier(self->conn->pgconn, cpname,
|
||||||
strlen(cpname)))) {
|
strlen(cpname)))) {
|
||||||
Py_XDECREF(bpname);
|
Py_XDECREF(bpname);
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
|
||||||
"libpq failed to escape identifier!");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1132,8 +1120,6 @@ psyco_curs_callproc(cursorObject *self, PyObject *args)
|
||||||
sql[sl-1] = '\0';
|
sql[sl-1] = '\0';
|
||||||
|
|
||||||
if (!(parameters = PyDict_Values(parameters))) {
|
if (!(parameters = PyDict_Values(parameters))) {
|
||||||
PyErr_SetString(PyExc_RuntimeError,
|
|
||||||
"built-in 'values' failed on a Dict!");
|
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue
Block a user