[pypy-svn] r73101 - pypy/branch/stackovf/pypy/module/_sre

arigo at codespeak.net arigo at codespeak.net
Mon Mar 29 18:32:09 CEST 2010


Author: arigo
Date: Mon Mar 29 18:31:52 2010
New Revision: 73101

Modified:
   pypy/branch/stackovf/pypy/module/_sre/interp_sre.py
Log:
Catch the RuntimeErrors coming from rlib.rsre and raise w_RuntimeErrors.


Modified: pypy/branch/stackovf/pypy/module/_sre/interp_sre.py
==============================================================================
--- pypy/branch/stackovf/pypy/module/_sre/interp_sre.py	(original)
+++ pypy/branch/stackovf/pypy/module/_sre/interp_sre.py	Mon Mar 29 18:31:52 2010
@@ -177,10 +177,20 @@
     state = space.interp_w(W_State, w_state)
     pattern_codes = [intmask(space.uint_w(code)) for code
                                     in space.unpackiterable(w_pattern_codes)]
-    return space.newbool(state.search(pattern_codes))
+    try:
+        res = state.search(pattern_codes)
+    except RuntimeError:
+        raise OperationError(space.w_RuntimeError,
+                             space.wrap("Internal re error"))
+    return space.newbool(res)
 
 def w_match(space, w_state, w_pattern_codes):
     state = space.interp_w(W_State, w_state)
     pattern_codes = [intmask(space.uint_w(code)) for code
                                     in space.unpackiterable(w_pattern_codes)]
-    return space.newbool(state.match(pattern_codes))
+    try:
+        res = state.match(pattern_codes)
+    except RuntimeError:
+        raise OperationError(space.w_RuntimeError,
+                             space.wrap("Internal re error"))
+    return space.newbool(res)



More information about the Pypy-commit mailing list