diff options
Diffstat (limited to 'psycopg/pqpath.c')
-rw-r--r-- | psycopg/pqpath.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/psycopg/pqpath.c b/psycopg/pqpath.c index 816adb2..e850699 100644 --- a/psycopg/pqpath.c +++ b/psycopg/pqpath.c @@ -956,9 +956,10 @@ pq_execute(cursorObject *curs, const char *query, int async) if (pq_fetch(curs) < 0) return -1; } else { + PyObject *tmp; curs->conn->async_status = async_status; - curs->conn->async_cursor = PyWeakref_NewRef((PyObject *)curs, NULL); - if (!curs->conn->async_cursor) { + curs->conn->async_cursor = tmp = PyWeakref_NewRef((PyObject *)curs, NULL); + if (!tmp) { /* weakref creation failed */ return -1; } |