[pypy-dev] cpython changed _sre between 2.7.3 to 2.7.4, now intmask(pattern) is negative

Armin Rigo arigo at tunes.org
Mon Jun 3 10:15:04 CEST 2013


Re-Hi,

On Mon, Jun 3, 2013 at 10:00 AM, Armin Rigo <arigo at tunes.org> wrote:
> On Sun, Jun 2, 2013 at 10:58 PM, Matti Picus <matti.picus at gmail.com> wrote:
>> Running own tests on win32 gives many errors in the _sre module:
>> rlib/rsre/rsre_core.py:111: AssertionError
>> which is checking that all values of the pattern are >=0

Ok, it's going to be tons of fun.  CPython changed in c1b3d25882ca a
detail in both the pure Python sre compiler and in the _sre.c module.
This means that now regexps created with Python 2.7.3 don't work with
Python 2.7.4's built-in _sre module and vice-versa.  Argh!  Of course
PyPy still has a 2.7.3-compatible _sre module.  So the own tests need
to be skipped when we are running CPython 2.7.4 or higher.
Conversely, once we do the upgrade of PyPy to 2.7.4, they will need to
be skipped if running CPython 2.7.3 or lower.

The alternative is to include the complete sre*.py from CPython 2.7.3
into PyPy's rpython/rlib/rsre/, for the purposes of running the tests
--- but also for the purposes of some other non-PyPy RPython
interpreter that uses rsre to get regexps at translation time.  This
means basically fixing get_hacked_sre_compile() in rlib/rsre/rpy.py to
not include the standard module's sre_compile and sre_constants, but
instead our own version of it.


A bientôt,

Armin.


More information about the pypy-dev mailing list