[ python-Bugs-1184380 ] example broken in section 1.12 of Extending & Embedding

SourceForge.net noreply at sourceforge.net
Sun Jun 5 12:57:31 CEST 2005


Bugs item #1184380, was opened at 2005-04-16 21:36
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1184380&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 1
Submitted By: bamoore (bamoore)
Assigned to: Nobody/Anonymous (nobody)
Summary: example broken in section 1.12 of Extending & Embedding

Initial Comment:
In section 1.12 of Extending and Embedding the Python
Interpreter Release 2.4, the example (spammodule) does
not compile on linux with distutils.  I get the following:
~/sandbox/python/c_api_test$ python2.4 spam-setup.py build
running build
running build_ext
building 'spam' extension
creating build
creating build/temp.linux-i686-2.4
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
-Wstrict-prototypes -fPIC -I/usr/include/python2.4 -c
spammodule.c -o build/temp.linux-i686-2.4/spammodule.o
spammodule.c:7: error: conflicting types for
`PySpam_System'
spammodule.h:21: error: previous declaration of
`PySpam_System'
error: command 'gcc' failed with exit status 1

I think the solution is to change line 12 of the
spammodule header file listing from:

#define PySpam_System_PROTO (char *command)

to:

#define PySpam_System_PROTO (const char *command)

as that seems to compile for me.  (though not tested
from another C extension).

----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-05 12:57

Message:
Logged In: YES 
user_id=1188172

Thanks, fixed as Doc/ext/extending.tex r1.33, r1.30.4.3

----------------------------------------------------------------------

Comment By: Luis Bruno (lbruno)
Date: 2005-04-21 16:05

Message:
Logged In: YES 
user_id=1263795

AIUI, your solution is correct; a cursory glance through the
PyArg_ParseTuple() documentation and the system() manual
page leads me to believe we're expecting a const char *.

I'll submit a patch.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1184380&group_id=5470


More information about the Python-bugs-list mailing list