Flag cpychecker false positives in adapters

This commit is contained in:
Daniele Varrazzo 2019-01-21 01:52:23 +00:00
parent bcd7fca543
commit d344ff818a
11 changed files with 15 additions and 13 deletions

View File

@ -108,7 +108,7 @@ asis_setup(asisObject *self, PyObject *obj)
); );
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("asis_setup: good asis object at %p, refcnt = " Dprintf("asis_setup: good asis object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -133,7 +133,7 @@ static PyObject *
binary_getquoted(binaryObject *self, PyObject *args) binary_getquoted(binaryObject *self, PyObject *args)
{ {
if (self->buffer == NULL) { if (self->buffer == NULL) {
self->buffer = binary_quote(self); self->buffer = TO_STATE(binary_quote(self));
} }
Py_XINCREF(self->buffer); Py_XINCREF(self->buffer);
return self->buffer; return self->buffer;
@ -210,7 +210,7 @@ binary_setup(binaryObject *self, PyObject *str)
self->buffer = NULL; self->buffer = NULL;
self->conn = NULL; self->conn = NULL;
Py_INCREF(str); Py_INCREF(str);
self->wrapped = str; self->wrapped = TO_STATE(str);
Dprintf("binary_setup: good binary object at %p, refcnt = " Dprintf("binary_setup: good binary object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -177,7 +177,7 @@ pydatetime_setup(pydatetimeObject *self, PyObject *obj, int type)
self->type = type; self->type = type;
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("pydatetime_setup: good pydatetime object at %p, refcnt = " Dprintf("pydatetime_setup: good pydatetime object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -240,7 +240,7 @@ list_setup(listObject *self, PyObject *obj)
self->connection = NULL; self->connection = NULL;
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("list_setup: good list object at %p, refcnt = " Dprintf("list_setup: good list object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -163,7 +163,7 @@ mxdatetime_setup(mxdatetimeObject *self, PyObject *obj, int type)
self->type = type; self->type = type;
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("mxdatetime_setup: good mxdatetime object at %p, refcnt = " Dprintf("mxdatetime_setup: good mxdatetime object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -96,7 +96,7 @@ pboolean_setup(pbooleanObject *self, PyObject *obj)
); );
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("pboolean_setup: good pboolean object at %p, refcnt = " Dprintf("pboolean_setup: good pboolean object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -161,7 +161,7 @@ pdecimal_setup(pdecimalObject *self, PyObject *obj)
); );
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("pdecimal_setup: good pdecimal object at %p, refcnt = " Dprintf("pdecimal_setup: good pdecimal object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -35,6 +35,7 @@
/** the Float object **/ /** the Float object **/
IGNORE_REFCOUNT /* bug davidmalcolm/gcc-python-plugin#165 */
static PyObject * static PyObject *
pfloat_getquoted(pfloatObject *self, PyObject *args) pfloat_getquoted(pfloatObject *self, PyObject *args)
{ {
@ -134,7 +135,7 @@ pfloat_setup(pfloatObject *self, PyObject *obj)
); );
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("pfloat_setup: good pfloat object at %p, refcnt = " Dprintf("pfloat_setup: good pfloat object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -139,7 +139,7 @@ pint_setup(pintObject *self, PyObject *obj)
); );
Py_INCREF(obj); Py_INCREF(obj);
self->wrapped = obj; self->wrapped = TO_STATE(obj);
Dprintf("pint_setup: good pint object at %p, refcnt = " Dprintf("pint_setup: good pint object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -74,6 +74,7 @@ qstring_quote(qstringObject *self)
/* encode the string into buffer */ /* encode the string into buffer */
Bytes_AsStringAndSize(str, &s, &len); Bytes_AsStringAndSize(str, &s, &len);
if (!(buffer = psycopg_escape_string(self->conn, s, len, NULL, &qlen))) { if (!(buffer = psycopg_escape_string(self->conn, s, len, NULL, &qlen))) {
FAKE_RAISE();
goto exit; goto exit;
} }
@ -98,7 +99,7 @@ static PyObject *
qstring_getquoted(qstringObject *self, PyObject *args) qstring_getquoted(qstringObject *self, PyObject *args)
{ {
if (self->buffer == NULL) { if (self->buffer == NULL) {
self->buffer = qstring_quote(self); self->buffer = TO_STATE(qstring_quote(self));
} }
Py_XINCREF(self->buffer); Py_XINCREF(self->buffer);
return self->buffer; return self->buffer;
@ -215,7 +216,7 @@ qstring_setup(qstringObject *self, PyObject *str)
); );
Py_INCREF(str); Py_INCREF(str);
self->wrapped = str; self->wrapped = TO_STATE(str);
Dprintf("qstring_setup: good qstring object at %p, refcnt = " Dprintf("qstring_setup: good qstring object at %p, refcnt = "
FORMAT_CODE_PY_SSIZE_T, FORMAT_CODE_PY_SSIZE_T,

View File

@ -99,8 +99,8 @@ static struct PyMemberDef isqlquoteObject_members[] = {
static int static int
isqlquote_setup(isqlquoteObject *self, PyObject *wrapped) isqlquote_setup(isqlquoteObject *self, PyObject *wrapped)
{ {
self->wrapped = wrapped;
Py_INCREF(wrapped); Py_INCREF(wrapped);
self->wrapped = TO_STATE(wrapped);
return 0; return 0;
} }