summaryrefslogtreecommitdiff
path: root/psycopg/lobject_int.c
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-10 00:29:09 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2011-01-10 00:46:02 +0000
commit79048ff19a2e3d14b8c7fa73f53ea3da9705afdd (patch)
treeb12044135997adc76e16ab18bd16de40a023b808 /psycopg/lobject_int.c
parentf345e7daeb1f4a80be168215b7256ae3a9c5b6c3 (diff)
parent48588e5f6943ad31ac9080536514e4ef5e52a60c (diff)
downloadpsycopg2-79048ff19a2e3d14b8c7fa73f53ea3da9705afdd.tar.gz
Merge branch 'python2' into python3
Conflicts: NEWS-2.3 tests/__init__.py tests/test_lobject.py tests/test_quote.py tests/testutils.py
Diffstat (limited to 'psycopg/lobject_int.c')
-rw-r--r--psycopg/lobject_int.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/psycopg/lobject_int.c b/psycopg/lobject_int.c
index b78b4a9..6ee3ecf 100644
--- a/psycopg/lobject_int.c
+++ b/psycopg/lobject_int.c
@@ -127,6 +127,21 @@ lobject_close_locked(lobjectObject *self, char **error)
{
int retvalue;
+ Dprintf("lobject_close_locked: conn->closed %ld", self->conn->closed);
+ switch (self->conn->closed) {
+ case 0:
+ /* Connection is open, go ahead */
+ break;
+ case 1:
+ /* Connection is closed, return a success */
+ return 0;
+ break;
+ default:
+ PyErr_SetString(OperationalError, "the connection is broken");
+ return -1;
+ break;
+ }
+
if (self->conn->isolation_level == ISOLATION_LEVEL_AUTOCOMMIT ||
self->conn->mark != self->mark ||
self->fd == -1)