[Python-Dev] How to make _sre.c compile w/ C++? (original) (raw)

skip at pobox.com skip at pobox.com
Tue Apr 18 03:27:07 CEST 2006


I checked in a number of minor changes this evening to correct various problems compiling Python with a C++ compiler, in my case Apple's version of g++ 4.0. I'm stuck on Modules/_sre.c though. After applying this change:

Index: Modules/_sre.c

--- Modules/_sre.c (revision 45497) +++ Modules/_sre.c (working copy) @@ -2284,10 +2284,10 @@ ptr = getstring(ptemplate, &n, &b); if (ptr) { if (b == 1) {

#if defined(HAVE_UNICODE)

#endif } } else {

I am left with this error:

../Modules/_sre.c: In function 'PyObject* pattern_subx(PatternObject*, PyObject*, PyObject*, int, int)': ../Modules/_sre.c:2287: error: cannot convert 'Py_UNICODE*' to 'unsigned char*' for argument '1' to 'int sre_literal_template(unsigned char*, int)'

During the 16-bit pass, SRE_CHAR expands to Py_UNICODE, so the call to sre_literal_template is incorrect. Any ideas how to fix things?

As clever as the two-pass compilation thing is, I must admit it confuses me.

Thx,

Skip



More information about the Python-Dev mailing list