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

Matti Picus matti.picus at gmail.com
Sun Jun 2 22:58:17 CEST 2013


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
Here is one of many such failures:
http://buildbot.pypy.org/summary/longrepr?testname=TestMatch.%28%29.test_repeated_set&builder=own-win-x86-32&build=40&mod=rlib.rsre.test.test_match

It turns out that the buildbot has been updated to use python 2.7.4, and 
in cpython's changeset c67b7e0c818a they changed the type of SRE_CODE 
from int to long.
We demand the pattern values be int via a call to intmask in 
rpython/rlib/rsre/rsre_core.py line 37-8:
def my_compile(pattern, flags, code, *args):
     raise GotIt(*[intmask*(i) for i in code], flags, args)

This call flips the sign of long values to <0, hence the tests fail.

Note this would also happen on Linux32, except that the cpython used in 
the tests is 2.6.5
http://buildbot.pypy.org/builders/own-linux-x86-32/builds/3044/steps/shell_7/logs/stdio

So far the detective work, can someone suggest a fix?
Matti


More information about the pypy-dev mailing list