Further cpychecker annotations

This commit is contained in:
Daniele Varrazzo 2019-01-23 09:29:36 +00:00
parent d38ffc6cf1
commit 1f62b47dc5
3 changed files with 11 additions and 8 deletions

View File

@ -56,7 +56,7 @@ typecast_array_cleanup(const char **str, Py_ssize_t *len)
#define ASCAN_TOKEN 3 #define ASCAN_TOKEN 3
#define ASCAN_QUOTED 4 #define ASCAN_QUOTED 4
static int RAISES_NEG static int
typecast_array_tokenize(const char *str, Py_ssize_t strlength, typecast_array_tokenize(const char *str, Py_ssize_t strlength,
Py_ssize_t *pos, char** token, Py_ssize_t *pos, char** token,
Py_ssize_t *length, int *quotes) Py_ssize_t *length, int *quotes)
@ -202,7 +202,8 @@ typecast_array_scan(const char *str, Py_ssize_t strlength,
if (obj == NULL) return -1; if (obj == NULL) return -1;
PyList_Append(array, obj); PyList_Append(array, obj);
Py_DECREF(obj); TO_STATE(obj);
Py_CLEAR(obj);
} }
else if (state == ASCAN_BEGIN) { else if (state == ASCAN_BEGIN) {

View File

@ -155,6 +155,7 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs)
* an easy format. * an easy format.
*/ */
if (NULL == (buffer = psycopg_parse_hex(s, l, &len))) { if (NULL == (buffer = psycopg_parse_hex(s, l, &len))) {
FAKE_RAISE(); /* issue davidmalcolm/gcc-python-plugin#75 */
goto exit; goto exit;
} }
} }
@ -170,6 +171,7 @@ typecast_BINARY_cast(const char *s, Py_ssize_t l, PyObject *curs)
* story. * story.
*/ */
if (NULL == (buffer = psycopg_parse_escape(s, l, &len))) { if (NULL == (buffer = psycopg_parse_escape(s, l, &len))) {
FAKE_RAISE(); /* issue davidmalcolm/gcc-python-plugin#75 */
goto exit; goto exit;
} }
} }

View File

@ -131,12 +131,12 @@ xid_init(xidObject *self, PyObject *args, PyObject *kwargs)
} }
} }
if (!(self->format_id = PyInt_FromLong(format_id))) { return -1; } if (!(self->format_id = TO_STATE(PyInt_FromLong(format_id)))) { return -1; }
if (!(self->gtrid = Text_FromUTF8(gtrid))) { return -1; } if (!(self->gtrid = TO_STATE(Text_FromUTF8(gtrid)))) { return -1; }
if (!(self->bqual = Text_FromUTF8(bqual))) { return -1; } if (!(self->bqual = TO_STATE(Text_FromUTF8(bqual)))) { return -1; }
Py_INCREF(Py_None); self->prepared = Py_None; Py_INCREF(Py_None); self->prepared = TO_STATE(Py_None);
Py_INCREF(Py_None); self->owner = Py_None; Py_INCREF(Py_None); self->owner = TO_STATE(Py_None);
Py_INCREF(Py_None); self->database = Py_None; Py_INCREF(Py_None); self->database = TO_STATE(Py_None);
return 0; return 0;
} }