mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Fixed SystemError clobbering libpq errors raised without SQLSTATE
Bug vivisectioned by Eric Snow <http://archives.postgresql.org/psycopg/2011-04/msg00019.php>.
This commit is contained in:
parent
746afdf69f
commit
c08799b0b0
2
NEWS
2
NEWS
|
@ -6,6 +6,8 @@ What's new in psycopg 2.4.1
|
|||
- Don't fail connection if the client encoding is a non-normalized
|
||||
variant. Issue reported by Peter Eisentraut.
|
||||
- Correctly detect an empty query sent to the backend (ticket #46).
|
||||
- Fixed a SystemError clobbering libpq errors raised without SQLSTATE.
|
||||
Bug vivisectioned by Eric Snow.
|
||||
- Allow to specify --static-libpq on setup.py command line instead of
|
||||
just in 'setup.cfg'. Patch provided by Matthew Ryan (ticket #48).
|
||||
|
||||
|
|
|
@ -194,6 +194,11 @@ pq_raise(connectionObject *conn, cursorObject *curs, PGresult *pgres)
|
|||
if (code != NULL) {
|
||||
exc = exception_from_sqlstate(code);
|
||||
}
|
||||
else {
|
||||
/* Fallback if there is no exception code (reported happening e.g.
|
||||
* when the connection is closed). */
|
||||
exc = DatabaseError;
|
||||
}
|
||||
|
||||
/* try to remove the initial "ERROR: " part from the postgresql error */
|
||||
err2 = strip_severity(err);
|
||||
|
|
Loading…
Reference in New Issue
Block a user