By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,081 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

BUG: compiling PL/Python - Semi-SOLVED

P: n/a
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 outon 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 nodata returned */
PyObject *status; /* query status, SPI_OK_*, or SPI_ERR_* */
} PLyResultObject;

The problem is in ";" following "PyObject_HEAD". "PyObject_HEAD" is a macrodefined 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.
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.