Unlock the connection after PQflush error

Apparently this has never happened... anyway the code path was wrong.

Fixes #294.
This commit is contained in:
Daniele Varrazzo 2015-05-03 11:44:10 +01:00
parent 4078b89521
commit ad3e91a56f
2 changed files with 5 additions and 0 deletions

1
NEWS
View File

@ -4,6 +4,7 @@ Current release
What's new in psycopg 2.6.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Correctly unlock the connection after error in flush (:ticket:`#294`).
- Fixed ``MinTimeLoggingCursor.callproc()`` (:ticket:`#309`).

View File

@ -980,6 +980,10 @@ pq_execute(cursorObject *curs, const char *query, int async, int no_result, int
}
else {
/* there was an error */
pthread_mutex_unlock(&(curs->conn->lock));
Py_BLOCK_THREADS;
PyErr_SetString(OperationalError,
PQerrorMessage(curs->conn->pgconn));
return -1;
}
}