Commits

Ronan Lamy committed b1d037d

Replace Reraise exception with RaiseWithExplicitTraceback

  • Participants
  • Parent commits d8025c2
  • Branches translation-cleanup

Comments (0)

Files changed (2)

pypy/interpreter/pyopcode.py

             next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
         except OperationError, operr:
             next_instr = self.handle_operation_error(ec, operr)
-        except Reraise:
-            operr = self.last_exception
-            next_instr = self.handle_operation_error(ec, operr,
-                                                     attach_tb=False)
         except RaiseWithExplicitTraceback, e:
             next_instr = self.handle_operation_error(ec, e.operr,
                                                      attach_tb=False)
                     space.wrap("raise: no active exception to re-raise"))
             # re-raise, no new traceback obj will be attached
             self.last_exception = operror
-            raise Reraise
+            raise RaiseWithExplicitTraceback(operror)
 
         w_value = w_traceback = space.w_None
         if nbargs >= 3:
 class Yield(ExitFrame):
     """Raised when exiting a frame via a 'yield' statement."""
 
-class Reraise(Exception):
-    """Raised at interp-level by a bare 'raise' statement."""
 class RaiseWithExplicitTraceback(Exception):
-    """Raised at interp-level by a 3-arguments 'raise' statement."""
+    """Raised at interp-level by a 0- or 3-arguments 'raise' statement."""
     def __init__(self, operr):
         self.operr = operr
 

pypy/objspace/flow/flowcontext.py

 from pypy.interpreter.pycode import CO_OPTIMIZED, CO_NEWLOCALS
 from pypy.interpreter.argument import ArgumentsForTranslation
 from pypy.interpreter.pyopcode import (Return, Yield, SuspendedUnroller,
-        SReturnValue, SApplicationException, BytecodeCorruption, Reraise,
+        SReturnValue, SApplicationException, BytecodeCorruption,
         RaiseWithExplicitTraceback)
 from pypy.objspace.flow.model import *
 from pypy.objspace.flow.framestate import (FrameState, recursively_unflatten,
         except OperationError, operr:
             self.attach_traceback(operr)
             next_instr = self.handle_operation_error(operr)
-        except Reraise:
-            operr = self.last_exception
-            next_instr = self.handle_operation_error(operr)
         except RaiseWithExplicitTraceback, e:
             next_instr = self.handle_operation_error(e.operr)
         return next_instr
             if self.last_exception is not None:
                 operror = self._convert_exc(self.last_exception)
                 self.last_exception = operror
-                raise Reraise
+                raise RaiseWithExplicitTraceback(operror)
             else:
                 raise OperationError(space.w_TypeError,
                     space.wrap("raise: no active exception to re-raise"))