From 1d0ae3eb9bad187f5718ec13ebb53b87eae820d7 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 28 Dec 2018 17:41:17 +0100 Subject: [PATCH] Work around false cpychecker false positive davidmalcolm/gcc-python-plugin#158 --- psycopg/connection_type.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/psycopg/connection_type.c b/psycopg/connection_type.c index fdd9b0ec..ee8b67c3 100644 --- a/psycopg/connection_type.c +++ b/psycopg/connection_type.c @@ -474,6 +474,16 @@ _psyco_conn_parse_isolevel(PyObject *pyval) } rv = level; + + /* Redundant test, checked above. + * Work around a cpychecker false positive. + * davidmalcolm/gcc-python-plugin#158 + */ + if (rv < 0) { + PyErr_SetString(PyExc_ValueError, + "isolation_level must be between 1 and 4"); + goto exit; + } } /* parse from the string -- this includes "default" */