[pypy-svn] r14147 - pypy/branch/dist-2.4.1/lib-python/modified-2.4.1
arigo at codespeak.net
arigo at codespeak.net
Sun Jul 3 16:35:54 CEST 2005
Author: arigo
Date: Sun Jul 3 16:35:53 2005
New Revision: 14147
Added:
pypy/branch/dist-2.4.1/lib-python/modified-2.4.1/sre_compile.py
- copied, changed from r14145, pypy/branch/dist-2.4.1/lib-python/2.4.1/sre_compile.py
pypy/branch/dist-2.4.1/lib-python/modified-2.4.1/sre_constants.py
- copied, changed from r14145, pypy/branch/dist-2.4.1/lib-python/2.4.1/sre_constants.py
Log:
Ported Gustavo's excellent revision 14146 in the other direction:
it allows regular expressions to work in PyPy/2.4.1 on top of Python 2.3.
Copied: pypy/branch/dist-2.4.1/lib-python/modified-2.4.1/sre_compile.py (from r14145, pypy/branch/dist-2.4.1/lib-python/2.4.1/sre_compile.py)
==============================================================================
--- pypy/branch/dist-2.4.1/lib-python/2.4.1/sre_compile.py (original)
+++ pypy/branch/dist-2.4.1/lib-python/modified-2.4.1/sre_compile.py Sun Jul 3 16:35:53 2005
@@ -14,7 +14,8 @@
from sre_constants import *
-assert _sre.MAGIC == MAGIC, "SRE module mismatch"
+# XXX see PyPy hack in sre_constants to support both the 2.3 and 2.4 _sre.c implementation.
+#assert _sre.MAGIC == MAGIC, "SRE module mismatch"
if _sre.CODESIZE == 2:
MAXCODE = 65535
Copied: pypy/branch/dist-2.4.1/lib-python/modified-2.4.1/sre_constants.py (from r14145, pypy/branch/dist-2.4.1/lib-python/2.4.1/sre_constants.py)
==============================================================================
--- pypy/branch/dist-2.4.1/lib-python/2.4.1/sre_constants.py (original)
+++ pypy/branch/dist-2.4.1/lib-python/modified-2.4.1/sre_constants.py Sun Jul 3 16:35:53 2005
@@ -127,6 +127,14 @@
]
+# PyPy hack to make the sre_*.py files from 2.4.1 work on the _sre
+# engine of 2.3.
+import _sre
+if _sre.MAGIC < 20031017:
+ OPCODES.remove(GROUPREF_EXISTS)
+del _sre
+
+
ATCODES = [
AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,
AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,
More information about the Pypy-commit
mailing list