[pypy-commit] pypy utf8-unicode2: Fix _sre

waedt noreply at buildbot.pypy.org
Sun Jul 13 13:31:22 CEST 2014


Author: Tyler Wade <wayedt at gmail.com>
Branch: utf8-unicode2
Changeset: r72430:f19e309962b5
Date: 2014-07-10 10:26 -0500
http://bitbucket.org/pypy/pypy/changeset/f19e309962b5/

Log:	Fix _sre

diff --git a/pypy/module/_sre/interp_sre.py b/pypy/module/_sre/interp_sre.py
--- a/pypy/module/_sre/interp_sre.py
+++ b/pypy/module/_sre/interp_sre.py
@@ -5,6 +5,7 @@
 from pypy.interpreter.typedef import make_weakref_descr
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
 from pypy.interpreter.error import OperationError
+from pypy.interpreter.utf8 import utf8ord
 from rpython.rlib.rarithmetic import intmask
 from rpython.rlib import jit
 
@@ -28,6 +29,15 @@
 import pypy.objspace.std.unicodeobject
 set_unicode_db(pypy.objspace.std.unicodeobject.unicodedb)
 
+
+# Monkey patch UnicodeMatchContext so we can use our own unicode type instead
+# of the built-in unicode.
+def _utf8_UnicodeMatchContext_str(self, index):
+    rsre_core.check_nonneg(index)
+    return utf8ord(self._unicodestr, index)
+rsre_core.UnicodeMatchContext.str = _utf8_UnicodeMatchContext_str
+
+
 # ____________________________________________________________
 #
 


More information about the pypy-commit mailing list