From daff2ea1beaf37cc457b875b8788b4c7fec12d1f Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 28 Dec 2018 18:03:24 +0100 Subject: [PATCH] Mark setter as raising on negative results Fixed static check of psyco_conn_cursor(). --- psycopg/connection_type.c | 4 ++-- psycopg/cursor.h | 4 ++-- psycopg/cursor_type.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index f531113e..ca61a7fd 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -112,10 +112,10 @@ psyco_conn_cursor(connectionObject *self, PyObject *args, PyObject *kwargs) goto exit; } - if (0 != psyco_curs_withhold_set((cursorObject *)obj, withhold)) { + if (0 > psyco_curs_withhold_set((cursorObject *)obj, withhold)) { goto exit; } - if (0 != psyco_curs_scrollable_set((cursorObject *)obj, scrollable)) { + if (0 > psyco_curs_scrollable_set((cursorObject *)obj, scrollable)) { goto exit; } diff --git a/psycopg/cursor.h b/psycopg/cursor.h index d89bf219..300b8916 100644 --- a/psycopg/cursor.h +++ b/psycopg/cursor.h @@ -93,8 +93,8 @@ struct cursorObject { /* C-callable functions in cursor_int.c and cursor_type.c */ BORROWED HIDDEN PyObject *curs_get_cast(cursorObject *self, PyObject *oid); HIDDEN void curs_reset(cursorObject *self); -HIDDEN int psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue); -HIDDEN int psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue); +RAISES_NEG HIDDEN int psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue); +RAISES_NEG HIDDEN int psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue); HIDDEN PyObject *psyco_curs_validate_sql_basic(cursorObject *self, PyObject *sql); /* exception-raising macros */ diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 591f5b32..e6368247 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -1681,7 +1681,7 @@ psyco_curs_withhold_get(cursorObject *self) return PyBool_FromLong(self->withhold); } -int +RAISES_NEG int psyco_curs_withhold_set(cursorObject *self, PyObject *pyvalue) { int value; @@ -1726,7 +1726,7 @@ psyco_curs_scrollable_get(cursorObject *self) return ret; } -int +RAISES_NEG int psyco_curs_scrollable_set(cursorObject *self, PyObject *pyvalue) { int value;