BUG: compiling PL/Python - Semi-SOLVED

From: "Nikola Milutinovic" <Nikola(dot)Milutinovic(at)ev(dot)co(dot)yu>
To: <pgsql-general(at)postgresql(dot)org>
Subject: BUG: compiling PL/Python - Semi-SOLVED
Date: 2004-01-02 15:55:01
Message-ID: 000901c3d148$cc84eda0$c53da8c0@home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all.

OS: Tru64 UNIX 4.0d
PG: PostgreSQL v7.4.1
PY: Python v2.3.3

I just ran into a minor bug while compiling PL/Python module. It bombed out on lines 153 and 160 of ./src/pl/plpython/plpython.c complaining on incomplete type "PyObject_HEAD".

The source of the problem were these two typedefs:

typedef struct PLyPlanObject
{
PyObject_HEAD;
void *plan; /* return of an SPI_saveplan */
int nargs;
Oid *types;
Datum *values;
PLyTypeInfo *args;
} PLyPlanObject;

typedef struct PLyResultObject
{
PyObject_HEAD;
/* HeapTuple *tuples; */
PyObject *nrows; /* number of rows returned by query */
PyObject *rows; /* data rows, or None if no data returned */
PyObject *status; /* query status, SPI_OK_*, or SPI_ERR_* */
} PLyResultObject;

The problem is in ";" following "PyObject_HEAD". "PyObject_HEAD" is a macro defined as:

#define PyObject_HEAD \
_PyObject_HEAD_EXTRA \
int ob_refcnt; \
struct _typeobject *ob_type;

So, that in turn expanded to this:

typedef struct PLyResultObject
{
int ob_refcnt ; struct _typeobject * ob_type ; ;
PyObject *nrows;
PyObject *rows;
PyObject *status;
} PLyResultObject;

The problem is in that extra semicolon - it is an excess and when removed everything compiles OK. Using this in a regular local variable declaration will not cause problems, since an extra ";" will just be swallowed as an NoOp.

Nix.

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2004-01-02 17:11:27 Re: [webmaster] website doc search is extremely SLOW
Previous Message ezra epstein 2004-01-02 15:18:45 Any way to have CREATEUSER privs without having all privs?