Compiling _namewrapper.c against Python 2.4

Fred Ludlow <[email protected]> Tue, 2 Nov 2010 22:15:56 +0000
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
--===============7527605994026079098==
Content-Type: multipart/alternative; boundary=20cf303bf6620970b00494194683

--20cf303bf6620970b00494194683
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I think an oldish bug has resurfaced (see
http://web.archiveorange.com/archive/v/GBNPV1aKn5iohvd2oUFP). I just tried
to build Cheetah 2.4.3 on a CentOS 5 virtual server running python 2.4 and
couldn't compile _namewrapper.c as PyUnicode_FromFormat isn't defined for
python 2.4.

I've sort of fixed this (in the sense it now builds, can import _namewrapper
and runs without warnings) by

1) adding the macro definition suggested in the above thread to
cheetah/c/cheetah.h
ie.
#ifndef PyUnicode_FromFormat
#define PyUnicode_FromFormat(a,b) PyString_FromFormat(a,b)
#endif

2) Changing the call to this macro in _namewrapper.c line 61 to only take 2
arguments (However, I did this just by ditching the 2nd argument (excValue)
and removing the relevant '%U' from the format string, ie. the line now
reads:
newExcValue = PyUnicode_FromFormat("Exception while searching for
\'%s\'",fullName);

I'm not familiar with the Python C API (or C really), so not really sure
what the best (and probably very simple) way to fix this properly is, but
thought this might provide some help for anyone in a similar position.

Cheers,

Fred

--20cf303bf6620970b00494194683
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,<div><br></div><div>I think an oldish bug has resurfaced (see=A0<a href=
=3D"http://web.archiveorange.com/archive/v/GBNPV1aKn5iohvd2oUFP">http://web=
.archiveorange.com/archive/v/GBNPV1aKn5iohvd2oUFP</a>). I just tried to bui=
ld Cheetah 2.4.3 on a CentOS 5 virtual server running python 2.4 and couldn=
&#39;t compile _namewrapper.c as=A0PyUnicode_FromFormat isn&#39;t defined f=
or python 2.4.=A0</div>

<div><br></div><div>I&#39;ve sort of fixed this (in the sense it now builds=
, can import _namewrapper and runs without warnings) by</div><div><br></div=
><div>1) adding the macro definition suggested in the above thread to cheet=
ah/c/cheetah.h=A0</div>

<div>ie.</div><div><div>#ifndef PyUnicode_FromFormat</div><div>#define PyUn=
icode_FromFormat(a,b) PyString_FromFormat(a,b)</div><div>#endif</div></div>=
<div><br></div><div>2) Changing the call to this macro in _namewrapper.c li=
ne 61 to only take 2 arguments (However, I did this just by ditching the 2n=
d argument (excValue) and removing the relevant &#39;%U&#39; from the forma=
t string, ie. the line now reads:</div>

<div><div>newExcValue =3D PyUnicode_FromFormat(&quot;Exception while search=
ing for \&#39;%s\&#39;&quot;,fullName);</div></div><div><br></div><div>I&#3=
9;m not familiar with the Python C API (or C really), so not really sure wh=
at the best (and probably very simple) way to fix this properly is, but tho=
ught this might provide some help for anyone in a similar position.</div>

<div><br></div><div>Cheers,</div><div><br></div><div>Fred</div>

--20cf303bf6620970b00494194683--


--===============7527605994026079098==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
--===============7527605994026079098==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

--===============7527605994026079098==--