summaryrefslogtreecommitdiff
path: root/psycopg/pqpath.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-08-07 01:53:21 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-08-07 01:53:21 +0100
commit2a4d6027a4e5732af1cdc41969c5cab3bb30430b (patch)
tree4f0ae8858ddaed8e23b3a803e4033fa77b7524f0 /psycopg/pqpath.c
parentd5443c65fde6cae87a1dcd901f31b6cdca7a1811 (diff)
parent90ee1ebba5d1da4bd9d8c6e12944308074732f08 (diff)
downloadpsycopg2-2a4d6027a4e5732af1cdc41969c5cab3bb30430b.tar.gz
Merge branch 'master' into replication-protocol
Conflicts: tests/testconfig.py
Diffstat (limited to 'psycopg/pqpath.c')
-rw-r--r--psycopg/pqpath.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c
index 6d6728c..220ae24 100644
--- a/psycopg/pqpath.c
+++ b/psycopg/pqpath.c
@@ -170,11 +170,11 @@ pq_raise(connectionObject *conn, cursorObject *curs, PGresult **pgres)
if (conn == NULL) {
PyErr_SetString(DatabaseError,
- "psycopg went psycotic and raised a null error");
+ "psycopg went psychotic and raised a null error");
return;
}
- /* if the connection has somehow beed broken, we mark the connection
+ /* if the connection has somehow been broken, we mark the connection
object as closed but requiring cleanup */
if (conn->pgconn != NULL && PQstatus(conn->pgconn) == CONNECTION_BAD)
conn->closed = 2;
@@ -916,7 +916,7 @@ pq_execute(cursorObject *curs, const char *query, int async, int no_result, int
PyErr_SetString(OperationalError, PQerrorMessage(curs->conn->pgconn));
return -1;
}
- Dprintf("curs_execute: pg connection at %p OK", curs->conn->pgconn);
+ Dprintf("pq_execute: pg connection at %p OK", curs->conn->pgconn);
Py_BEGIN_ALLOW_THREADS;
pthread_mutex_lock(&(curs->conn->lock));
@@ -941,7 +941,7 @@ pq_execute(cursorObject *curs, const char *query, int async, int no_result, int
Py_UNBLOCK_THREADS;
}
- /* dont let pgres = NULL go to pq_fetch() */
+ /* don't let pgres = NULL go to pq_fetch() */
if (curs->pgres == NULL) {
pthread_mutex_unlock(&(curs->conn->lock));
Py_BLOCK_THREADS;
@@ -1409,7 +1409,11 @@ _pq_copy_in_v3(cursorObject *curs)
Py_DECREF(str);
}
}
- PyErr_Restore(t, ex, tb);
+ /* Clear the Py exception: it will be re-raised from the libpq */
+ Py_XDECREF(t);
+ Py_XDECREF(ex);
+ Py_XDECREF(tb);
+ PyErr_Clear();
}
res = PQputCopyEnd(curs->conn->pgconn, buf);
}