Don't clobber an eventual Python exception set by a green thread

This commit is contained in:
Daniele Varrazzo 2011-06-05 16:30:37 +01:00
parent 8f876d4b5d
commit 709df38d79

View File

@ -343,12 +343,12 @@ pq_execute_command_locked(connectionObject *conn, const char *query,
*tstate = PyEval_SaveThread(); *tstate = PyEval_SaveThread();
} }
if (*pgres == NULL) { if (*pgres == NULL) {
const char *msg;
Dprintf("pq_execute_command_locked: PQexec returned NULL"); Dprintf("pq_execute_command_locked: PQexec returned NULL");
if (!PyErr_Occurred()) {
const char *msg;
msg = PQerrorMessage(conn->pgconn); msg = PQerrorMessage(conn->pgconn);
if (msg) if (msg && *msg) { *error = strdup(msg); }
*error = strdup(msg); }
goto cleanup; goto cleanup;
} }