New implementation of re module

Christopher Arndt chris.arndt at web.de
Tue Jul 28 19:07:26 CEST 2009


On 27 Jul., 21:27, Wolfgang Rohdewald <wolfg... at rohdewald.de> wrote:
> how do I compile _regex.c on Linux?

This simple setup.py file should do the trick:

from distutils.core import setup, Extension

setup(name='regex',
    version='1.0',
    py_modules = ['regex'],
    ext_modules=[Extension('_regex', ['_regex.c'])],
)

Also, you need to copy "unicodedata_db.h" from the "Modules" directory
of the Python source tree to your working directory, since this file
apparently is not installed into the include directory of a Python
installation.

I get an error for Python 2.5 on Mac OS X 10.4 and Linux though. Seems
that the module is not compatible with Python 2.5.

_regex.c: In function 'getstring':
_regex.c:2425: error: invalid type argument of '->'
_regex.c: In function 'getstring':
_regex.c:2425: error: invalid type argument of '->'
lipo: can't figure out the architecture type of: /var/tmp//
ccT3oDXD.out
error: command 'gcc' failed with exit status 1

resp. on Linux:

_regex.c: In function 'getstring':
_regex.c:2425: warning: implicit declaration of function 'Py_TYPE'
_regex.c:2425: error: invalid type argument of '->'
_regex.c: In function 'get_match_replacement':
_regex.c:2900: warning: implicit declaration of function
'PyLong_AsSsize_t'
error: command 'gcc' failed with exit status 1

With the official Python 2.6 distribution for Mac OS X it works.

Chris



More information about the Python-list mailing list