From 4d15b973b0eb59558f4f1bcc7183e0d4cbc9fbe1 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 1 Mar 2012 02:47:30 +0000 Subject: [PATCH] Attempt to enforce signature for the "O&" converter functions It seems causing a traceback in the static checker. Enforcing it simplifies the code, but doesn't help the checker. --- psycopg/cursor_type.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/psycopg/cursor_type.c b/psycopg/cursor_type.c index 030147d6..dbcc4788 100644 --- a/psycopg/cursor_type.c +++ b/psycopg/cursor_type.c @@ -1261,8 +1261,8 @@ exit: #define psyco_curs_copy_from_doc \ "copy_from(file, table, sep='\\t', null='\\\\N', size=8192, columns=None) -- Copy table from file." -static int -_psyco_curs_has_read_check(PyObject* o, void* var) +STEALS(1) static int +_psyco_curs_has_read_check(PyObject *o, PyObject **var) { if (PyObject_HasAttrString(o, "readline") && PyObject_HasAttrString(o, "read")) { @@ -1272,7 +1272,7 @@ _psyco_curs_has_read_check(PyObject* o, void* var) * which could invoke the garbage collector. We thus need an * INCREF/DECREF pair if we store this pointer in a GC object, such as * a cursorObject */ - *((PyObject**)var) = o; + *var = o; return 1; } else { @@ -1368,11 +1368,11 @@ exit: #define psyco_curs_copy_to_doc \ "copy_to(file, table, sep='\\t', null='\\\\N', columns=None) -- Copy table to file." -static int -_psyco_curs_has_write_check(PyObject* o, void* var) +STEALS(1) static int +_psyco_curs_has_write_check(PyObject *o, PyObject **var) { if (PyObject_HasAttrString(o, "write")) { - *((PyObject**)var) = o; + *var = o; return 1; } else {