mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-06-05 13:43:20 +03:00
Fixed refcount bug with connection destroyed in a 2PC transaction
This commit is contained in:
parent
5f6e773575
commit
abd7991968
|
@ -305,8 +305,6 @@ _psyco_conn_tpc_finish(connectionObject *self, PyObject *args,
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PyObject *tmp;
|
|
||||||
|
|
||||||
/* committing/aborting our own transaction. */
|
/* committing/aborting our own transaction. */
|
||||||
if (!self->tpc_xid) {
|
if (!self->tpc_xid) {
|
||||||
PyErr_SetString(ProgrammingError,
|
PyErr_SetString(ProgrammingError,
|
||||||
|
@ -332,11 +330,10 @@ _psyco_conn_tpc_finish(connectionObject *self, PyObject *args,
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Py_CLEAR(self->tpc_xid);
|
||||||
|
|
||||||
/* connection goes ready */
|
/* connection goes ready */
|
||||||
self->status = CONN_STATUS_READY;
|
self->status = CONN_STATUS_READY;
|
||||||
tmp = (PyObject *)self->tpc_xid;
|
|
||||||
self->tpc_xid = NULL;
|
|
||||||
Py_DECREF(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
|
@ -912,6 +909,7 @@ connection_dealloc(PyObject* obj)
|
||||||
if (self->encoding) free(self->encoding);
|
if (self->encoding) free(self->encoding);
|
||||||
if (self->critical) free(self->critical);
|
if (self->critical) free(self->critical);
|
||||||
|
|
||||||
|
Py_CLEAR(self->tpc_xid);
|
||||||
Py_CLEAR(self->async_cursor);
|
Py_CLEAR(self->async_cursor);
|
||||||
Py_CLEAR(self->notice_list);
|
Py_CLEAR(self->notice_list);
|
||||||
Py_CLEAR(self->notice_filter);
|
Py_CLEAR(self->notice_filter);
|
||||||
|
@ -965,6 +963,7 @@ connection_repr(connectionObject *self)
|
||||||
static int
|
static int
|
||||||
connection_traverse(connectionObject *self, visitproc visit, void *arg)
|
connection_traverse(connectionObject *self, visitproc visit, void *arg)
|
||||||
{
|
{
|
||||||
|
Py_VISIT(self->tpc_xid);
|
||||||
Py_VISIT(self->async_cursor);
|
Py_VISIT(self->async_cursor);
|
||||||
Py_VISIT(self->notice_list);
|
Py_VISIT(self->notice_list);
|
||||||
Py_VISIT(self->notice_filter);
|
Py_VISIT(self->notice_filter);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user