From 0b68f344d12bb5661ab32e44f82ba9d8803c8778 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 28 Dec 2018 04:20:18 +0100 Subject: [PATCH] Added attribute to ignore refcount check in a function Hacking a feature together in a ignore-refcount branch of cpychecker --- psycopg/bytes_format.c | 1 + psycopg/config.h | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/psycopg/bytes_format.c b/psycopg/bytes_format.c index 1693969c..3be46e6e 100644 --- a/psycopg/bytes_format.c +++ b/psycopg/bytes_format.c @@ -101,6 +101,7 @@ getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) /* wrapper around _Bytes_Resize offering normal Python call semantics */ +IGNORE_REFCOUNT STEALS(1) Py_LOCAL_INLINE(PyObject *) resize_bytes(PyObject *b, Py_ssize_t newsize) { diff --git a/psycopg/config.h b/psycopg/config.h index 6b33c2cf..f98ee408 100644 --- a/psycopg/config.h +++ b/psycopg/config.h @@ -202,4 +202,11 @@ static double round(double num) #define RAISES #endif +#if defined(WITH_CPYCHECKER_IGNORE_REFCOUNT_ATTRIBUTE) +#define IGNORE_REFCOUNT \ + __attribute__((cpychecker_ignore_refcount)) +#else +#define IGNORE_REFCOUNT +#endif + #endif /* !defined(PSYCOPG_CONFIG_H) */