[Python-Dev] How to make _sre.c compile w/ C++?
"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 = sre_literal_template(ptr, n);
> + literal = sre_literal_template((SRE_CHAR *)ptr, n);
> } else {
> #if defined(HAVE_UNICODE)
> - literal = sre_uliteral_template(ptr, n);
> + literal = sre_uliteral_template((Py_UNICODE *)ptr, n);
> #endif
> ../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?
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