From 3752880b7b59979cf0eaad6e0190d46e29df524e Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 5 Apr 2014 15:11:43 +0100 Subject: [PATCH] Fixed attempt of closing an already closed lobject on dealloc This results in a "null without exception set" in the corrent state, which is caused by the connection being unexpectedly closed anyway. --- psycopg/lobject_type.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psycopg/lobject_type.c b/psycopg/lobject_type.c index 1af352e3..068923c9 100644 --- a/psycopg/lobject_type.c +++ b/psycopg/lobject_type.c @@ -355,7 +355,7 @@ lobject_dealloc(PyObject* obj) { lobjectObject *self = (lobjectObject *)obj; - if (self->conn) { /* if not, init failed */ + if (self->conn && self->fd != -1) { if (lobject_close(self) < 0) PyErr_Print(); Py_XDECREF((PyObject*)self->conn);