[ python-Bugs-870855 ] C interface definition of PyObject_HEAD is
problematic
SourceForge.net
noreply at sourceforge.net
Mon Jan 5 09:09:32 EST 2004
Bugs item #870855, was opened at 2004-01-05 12:44
Message generated for change (Comment added) made by alokin1
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=870855&group_id=5470
Category: Python Library
Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: Nikola Milutinovic (alokin1)
Assigned to: Nobody/Anonymous (nobody)
Summary: C interface definition of PyObject_HEAD is problematic
Initial Comment:
I ran into a small problem, for which we have found a
workaround. I was compiling PostgreSQL v7.4.1 and it's
PL/Python module. Compilation failed on lines which had
this:
typedef struct PLyPlanObject {
PyObject_HEAD;
...
} PLyPlanObject;
The problem was in that semicolon following
"PyObject_HEAD", since that is a CPP define which
expands to this:
typedef struct PLyPlanObject {
int ob_refcnt ; struct _typeobject * ob_type ; ;
...
} PLyPlanObject;
That extra ";" breaks compiling on strict ANSI-C
compilers (or at least on mine - DEC CC on Tru64 UNIX).
The workaround was to remove the ";" from plpython.c
source file. It could be that GNU C is not complaining
on this, since it is more lenient on C irregularities.
----------------------------------------------------------
Could you change the definition of "PyObject_HEAD" to
exclude that ";" at the end?
If you do that, we can all write in our C source that
identifier "PyObject_HEAD" with ";" at the end. That
looks a bit more C-like than without it.
Nix.
----------------------------------------------------------------------
>Comment By: Nikola Milutinovic (alokin1)
Date: 2004-01-05 15:09
Message:
Logged In: YES
user_id=943977
I agree it would cause problems for those C modules that are
NOT putting ";" after "PyObject_HEAD". Are there any?
Even this problem I had was on an ANSI-C strict compiler. It
could very well be that most C extensions are meant for GCC
and would not feel a thing.
Of course, there is no way for you to know that. Maybe the
idea should be floated around for a while, before making a
decision.
Nix.
----------------------------------------------------------------------
Comment By: Michael Hudson (mwh)
Date: 2004-01-05 14:46
Message:
Logged In: YES
user_id=6656
Wouldn't that break every C extension to Python that's ever
been written? I agree it's not ideal the way things are, but...
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=870855&group_id=5470
More information about the Python-bugs-list
mailing list