From 07b8cfe4a558c25e2146bdc01fc7c5677ce77bc3 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 31 Dec 2018 00:30:02 +0100 Subject: [PATCH] cursor_type -- mark state setting to avoid cpychecker false positives --- psycopg/cursor_type.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index bae30abe..7c3284c2 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -1870,7 +1870,7 @@ cursor_setup(cursorObject *self, connectionObject *conn, const char *name) return -1; } */ Py_INCREF(conn); - self->conn = conn; + self->conn = (connectionObject *)TO_STATE((PyObject *)conn); self->mark = conn->mark; self->notuples = 1; @@ -1880,14 +1880,14 @@ cursor_setup(cursorObject *self, connectionObject *conn, const char *name) self->lastoid = InvalidOid; Py_INCREF(Py_None); - self->tuple_factory = Py_None; + self->tuple_factory = TO_STATE(Py_None); /* default tzinfo factory */ { PyObject *m = NULL; if ((m = PyImport_ImportModule("psycopg2.tz"))) { - self->tzinfo_factory = PyObject_GetAttrString( - m, "FixedOffsetTimezone"); + self->tzinfo_factory = TO_STATE(PyObject_GetAttrString( + m, "FixedOffsetTimezone")); Py_DECREF(m); } if (!self->tzinfo_factory) {