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

"Martin v. Löwis" martin at v.loewis.de
Tue Apr 18 07:22:02 CEST 2006


skip at pobox.com wrote:

if (b == 1) { - literal = sreliteraltemplate(ptr, n); + literal = sreliteraltemplate((SRECHAR *)ptr, n); } else { #if defined(HAVEUNICODE) - literal = sreuliteraltemplate(ptr, n); + literal = sreuliteraltemplate((PyUNICODE *)ptr, n); #endif ../Modules/sre.c: In function 'PyObject* patternsubx(PatternObject*, PyObject*, PyObject*, int, int)': ../Modules/sre.c:2287: error: cannot convert 'PyUNICODE*' to 'unsigned char*' for argument '1' to 'int sreliteraltemplate(unsigned char*, int)'

During the 16-bit pass, SRECHAR expands to PyUNICODE, so the call to sreliteraltemplate is incorrect. Any ideas how to fix things?

sre_literal_template doesn't take SRE_CHAR*, but unsigned char*. So just cast to that.

Regards, Martin



More information about the Python-Dev mailing list