[pypy-commit] pypy default: Fix for compatibility with CPython 2.7.4
rlamy
noreply at buildbot.pypy.org
Wed May 15 15:10:59 CEST 2013
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch:
Changeset: r64152:511204307897
Date: 2013-05-15 14:09 +0100
http://bitbucket.org/pypy/pypy/changeset/511204307897/
Log: Fix for compatibility with CPython 2.7.4
In 2.7.4, sre_compile imports MAX_REPEAT from _sre, so add it to
sre_hacked.
diff --git a/rpython/rlib/rsre/rpy.py b/rpython/rlib/rsre/rpy.py
--- a/rpython/rlib/rsre/rpy.py
+++ b/rpython/rlib/rsre/rpy.py
@@ -8,11 +8,12 @@
module is a custom module that has _sre.compile == my_compile
and CODESIZE == rsre_char.CODESIZE.
"""
- import sre_compile, __builtin__, new
+ import sre_compile, sre_constants, __builtin__, new
sre_hacked = new.module("_sre_hacked")
sre_hacked.compile = my_compile
sre_hacked.MAGIC = sre_compile.MAGIC
sre_hacked.CODESIZE = rsre_char.CODESIZE
+ sre_hacked.MAXREPEAT = sre_constants.MAX_REPEAT
sre_hacked.getlower = rsre_char.getlower
def my_import(name, *args):
if name == '_sre':
diff --git a/rpython/rlib/rsre/rsre_re.py b/rpython/rlib/rsre/rsre_re.py
--- a/rpython/rlib/rsre/rsre_re.py
+++ b/rpython/rlib/rsre/rsre_re.py
@@ -4,7 +4,7 @@
"""
import re, sys
from rpython.rlib.rsre import rsre_core, rsre_char
-from rpython.rlib.rsre.test.test_match import get_code as _get_code
+from rpython.rlib.rsre.rpy import get_code as _get_code
from rpython.rlib.unicodedata import unicodedb
from rpython.rlib.objectmodel import specialize
rsre_char.set_unicode_db(unicodedb)
@@ -176,7 +176,7 @@
def span(self, groupnum=0):
# if not isinstance(groupnum, (int, long)):
# groupnum = self.re.groupindex[groupnum]
-
+
return self._ctx.span(groupnum)
def start(self, groupnum=0):
More information about the pypy-commit
mailing list