mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-03-01 06:50:34 +03:00
Ref the async cursor before storing it in the connection
This commit is contained in:
parent
eb646f71fa
commit
062a9602ae
|
@ -74,6 +74,7 @@ curs_get_last_result(cursorObject *self) {
|
|||
IFCLEARPGRES(self->pgres);
|
||||
self->pgres = pgres;
|
||||
}
|
||||
Py_XDECREF(self->conn->async_cursor);
|
||||
self->conn->async_cursor = NULL;
|
||||
pthread_mutex_unlock(&(self->conn->lock));
|
||||
Py_END_ALLOW_THREADS;
|
||||
|
|
|
@ -299,6 +299,7 @@ pq_clear_async(connectionObject *conn)
|
|||
Dprintf("pq_clear_async: clearing PGresult at %p", pgres);
|
||||
CLEARPGRES(pgres);
|
||||
}
|
||||
Py_XDECREF(conn->async_cursor);
|
||||
conn->async_cursor = NULL;
|
||||
}
|
||||
|
||||
|
@ -746,6 +747,7 @@ pq_execute(cursorObject *curs, const char *query, int async)
|
|||
}
|
||||
else {
|
||||
curs->conn->async_status = async_status;
|
||||
Py_INCREF(curs);
|
||||
curs->conn->async_cursor = (PyObject*)curs;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user