This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: example broken in section 1.12 of Extending & Embedding
Type: Stage:
Components: Documentation Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: bamoore, georg.brandl, lbruno
Priority: low Keywords:

Created on 2005-04-16 19:36 by bamoore, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg25043 - (view) Author: bamoore (bamoore) Date: 2005-04-16 19:36
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).
msg25044 - (view) Author: Luis Bruno (lbruno) Date: 2005-04-21 14:05
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.
msg25045 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-06-05 10:57
Logged In: YES 
user_id=1188172

Thanks, fixed as Doc/ext/extending.tex r1.33, r1.30.4.3
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41867
2005-04-16 19:36:25bamoorecreate