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.
This commit is contained in:
Daniele Varrazzo 2014-04-05 15:11:43 +01:00
parent bbe5a2597c
commit ddf97a0cdc

View File

@ -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);