From 0abf947cd8e07b825f2a4785d348bb3ac075f6a5 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 21 Jan 2019 20:14:31 +0000 Subject: [PATCH] Ignore checking a few functions triggering cpychecker bugs With these changes cpychecker can run on the whole codebase without crashing. --- psycopg/psycopgmodule.c | 5 +++++ psycopg/typecast.c | 1 + psycopg/typecast_binary.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/psycopg/psycopgmodule.c b/psycopg/psycopgmodule.c index a8b0dc1a..3b520eed 100644 --- a/psycopg/psycopgmodule.c +++ b/psycopg/psycopgmodule.c @@ -123,6 +123,7 @@ psyco_connect(PyObject *self, PyObject *args, PyObject *keywds) #define psyco_parse_dsn_doc \ "parse_dsn(dsn) -> dict -- parse a connection string into parameters" +IGNORE_REFCOUNT /* bug #davidmalcolm/gcc-python-plugin#159 */ static PyObject * psyco_parse_dsn(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -165,6 +166,7 @@ exit: " * `str`: A bytes or unicode object\n" \ " * `conn_or_curs`: A connection or cursor, required" +IGNORE_REFCOUNT /* bug #davidmalcolm/gcc-python-plugin#159 */ static PyObject * psyco_quote_ident(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -421,6 +423,7 @@ psyco_libpq_version(PyObject *self, PyObject *dummy) #define psyco_encrypt_password_doc \ "encrypt_password(password, user, [scope], [algorithm]) -- Prepares the encrypted form of a PostgreSQL password.\n\n" +IGNORE_REFCOUNT /* bug #davidmalcolm/gcc-python-plugin#159 */ static PyObject * psyco_encrypt_password(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -672,6 +675,7 @@ static struct { }; +IGNORE_REFCOUNT /* bug #davidmalcolm/gcc-python-plugin#159 */ RAISES_NEG static int basic_errors_init(PyObject *module) { @@ -910,6 +914,7 @@ static struct { {NULL} /* Sentinel */ }; +IGNORE_REFCOUNT /* bug #davidmalcolm/gcc-python-plugin#159 */ RAISES_NEG static int add_module_types(PyObject *module) { diff --git a/psycopg/typecast.c b/psycopg/typecast.c index f6ea9284..30a8bc15 100644 --- a/psycopg/typecast.c +++ b/psycopg/typecast.c @@ -440,6 +440,7 @@ typecast_traverse(typecastObject *self, visitproc visit, void *arg) return 0; } +IGNORE_REFCOUNT /* bug davidmalcolm/gcc-python-plugin#159 */ static PyObject * typecast_repr(PyObject *self) { diff --git a/psycopg/typecast_binary.c b/psycopg/typecast_binary.c index 8226d3f4..3d09784f 100644 --- a/psycopg/typecast_binary.c +++ b/psycopg/typecast_binary.c @@ -218,6 +218,7 @@ static const char hex_lut[128] = { * Return a new buffer allocated by PyMem_Malloc and set 'sizeout' to its size. * In case of error set an exception and return NULL. */ +IGNORE_REFCOUNT /* bug davidmalcolm/gcc-python-plugin#155 */ static char * psycopg_parse_hex(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout) { @@ -268,6 +269,7 @@ exit: * Return a new buffer allocated by PyMem_Malloc and set 'sizeout' to its size. * In case of error set an exception and return NULL. */ +IGNORE_REFCOUNT /* bug davidmalcolm/gcc-python-plugin#155 */ static char * psycopg_parse_escape(const char *bufin, Py_ssize_t sizein, Py_ssize_t *sizeout) {