cursor_type -- mark state setting to avoid cpychecker false positives

This commit is contained in:
Daniele Varrazzo 2018-12-31 00:30:02 +01:00
parent 1d0ae3eb9b
commit 07b8cfe4a5

View File

@ -1870,7 +1870,7 @@ cursor_setup(cursorObject *self, connectionObject *conn, const char *name)
return -1; return -1;
} */ } */
Py_INCREF(conn); Py_INCREF(conn);
self->conn = conn; self->conn = (connectionObject *)TO_STATE((PyObject *)conn);
self->mark = conn->mark; self->mark = conn->mark;
self->notuples = 1; self->notuples = 1;
@ -1880,14 +1880,14 @@ cursor_setup(cursorObject *self, connectionObject *conn, const char *name)
self->lastoid = InvalidOid; self->lastoid = InvalidOid;
Py_INCREF(Py_None); Py_INCREF(Py_None);
self->tuple_factory = Py_None; self->tuple_factory = TO_STATE(Py_None);
/* default tzinfo factory */ /* default tzinfo factory */
{ {
PyObject *m = NULL; PyObject *m = NULL;
if ((m = PyImport_ImportModule("psycopg2.tz"))) { if ((m = PyImport_ImportModule("psycopg2.tz"))) {
self->tzinfo_factory = PyObject_GetAttrString( self->tzinfo_factory = TO_STATE(PyObject_GetAttrString(
m, "FixedOffsetTimezone"); m, "FixedOffsetTimezone"));
Py_DECREF(m); Py_DECREF(m);
} }
if (!self->tzinfo_factory) { if (!self->tzinfo_factory) {