From ddf97a0cdc0d692d87bd8b83cc56fdb72e1fe693 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 4a47721f..fad48a20 100644 --- a/psycopg/lobject_type.c +++ b/psycopg/lobject_type.c @@ -359,7 +359,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);