New implementation of re module

MRAB python at mrabarnett.plus.com
Tue Jul 28 19:25:43 CEST 2009


Christopher Arndt wrote:
> 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.
> 
The source code is intended to replace the current 're' module in Python
2.7 (and I'll be porting it to Python 3.2), so I'm not that worried
about Python versions earlier than 2.6 for testing, although if there's
sufficient need then I could tweak the sources for 2.5.



More information about the Python-list mailing list