Commits

Ronan Lamy committed d9fe70f

Remove _convert_exc()

Comments (0)

Files changed (3)

pypy/interpreter/executioncontext.py

             self._trace(frame, 'exception', None, operationerr)
         #operationerr.print_detailed_traceback(self.space)
 
-    def _convert_exc(self, operr):
-        # Only for the flow object space
-        return operr
-
     def sys_exc_info(self): # attn: the result is not the wrapped sys.exc_info() !!!
         """Implements sys.exc_info().
         Return an OperationError instance or None."""
         frame = self.gettopframe_nohidden()
         while frame:
             if frame.last_exception is not None:
-                return self._convert_exc(frame.last_exception)
+                return frame.last_exception
             frame = self.getnextframe_nohidden(frame)
         return None
 

pypy/interpreter/pyopcode.py

             ec = self.space.getexecutioncontext()
             while frame:
                 if frame.last_exception is not None:
-                    operror = ec._convert_exc(frame.last_exception)
+                    operror = frame.last_exception
                     break
                 frame = frame.f_backref()
             else:

pypy/objspace/flow/flowcontext.py

             candidates.insert(0, newblock)
             self.pendingblocks.append(newblock)
 
-    def _convert_exc(self, operr):
-        if isinstance(operr, ImplicitOperationError):
-            # re-raising an implicit operation makes it an explicit one
-            w_value = operr.get_w_value(self.space)
-            operr = FSException(operr.w_type, w_value)
-        return operr
-
     # hack for unrolling iterables, don't use this
     def replace_in_stack(self, oldvalue, newvalue):
         w_new = Constant(newvalue)
         space = self.space
         if nbargs == 0:
             if self.last_exception is not None:
-                operror = self._convert_exc(self.last_exception)
-                self.last_exception = operror
-                raise RaiseWithExplicitTraceback(operror)
+                operr = self.last_exception
+                if isinstance(operr, ImplicitOperationError):
+                    # re-raising an implicit operation makes it an explicit one
+                    w_value = operr.get_w_value(self.space)
+                    operr = FSException(operr.w_type, w_value)
+                self.last_exception = operr
+                raise RaiseWithExplicitTraceback(operr)
             else:
                 raise FSException(space.w_TypeError,
                     space.wrap("raise: no active exception to re-raise"))