mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 21:00:33 +03:00
Fixed potential failures while setting exceptions attributes
This commit is contained in:
parent
7d67ecbed3
commit
09be4dc5d1
|
@ -635,16 +635,18 @@ psyco_set_error(PyObject *exc, cursorObject *curs, const char *msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgerror) {
|
if (pgerror) {
|
||||||
t = conn_text_from_chars(conn, pgerror);
|
if ((t = conn_text_from_chars(conn, pgerror))) {
|
||||||
PyObject_SetAttrString(err, "pgerror", t);
|
PyObject_SetAttrString(err, "pgerror", t);
|
||||||
Py_DECREF(t);
|
Py_DECREF(t);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pgcode) {
|
if (pgcode) {
|
||||||
t = conn_text_from_chars(conn, pgcode);
|
if ((t = conn_text_from_chars(conn, pgcode))) {
|
||||||
PyObject_SetAttrString(err, "pgcode", t);
|
PyObject_SetAttrString(err, "pgcode", t);
|
||||||
Py_DECREF(t);
|
Py_DECREF(t);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PyErr_SetObject(exc, err);
|
PyErr_SetObject(exc, err);
|
||||||
Py_DECREF(err);
|
Py_DECREF(err);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user