From 61696b0603abc365b821dae27acd9c594d824468 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 5 Jun 2014 01:32:58 +0200 Subject: [PATCH] Added guard on params with no length on callproc --- psycopg/cursor_type.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 0ee70e69..ec315338 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -1042,9 +1042,8 @@ psyco_curs_callproc(cursorObject *self, PyObject *args) } if (parameters != Py_None) { - nparameters = PyObject_Length(parameters); - if (nparameters < 0) { - nparameters = 0; + if (-1 == (nparameters = PyObject_Length(parameters))) { + goto exit; } }