mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-12-03 14:13:43 +03:00
Don't clobber an eventual Python exception set by a green thread
This commit is contained in:
parent
8f876d4b5d
commit
709df38d79
|
@ -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");
|
||||||
msg = PQerrorMessage(conn->pgconn);
|
if (!PyErr_Occurred()) {
|
||||||
if (msg)
|
const char *msg;
|
||||||
*error = strdup(msg);
|
msg = PQerrorMessage(conn->pgconn);
|
||||||
|
if (msg && *msg) { *error = strdup(msg); }
|
||||||
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ pq_execute_command_locked(connectionObject *conn, const char *query,
|
||||||
retvalue = 0;
|
retvalue = 0;
|
||||||
IFCLEARPGRES(*pgres);
|
IFCLEARPGRES(*pgres);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
return retvalue;
|
return retvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user