Example #1
0
    def _convert_unexpected_exception(self, e):
        from pypy.interpreter import error

        operr = error.get_converted_unexpected_exception(self.space, e)
        pytraceback.record_application_traceback(self.space, operr, self,
                                                 self.last_instr)
        raise operr
Example #2
0
 def handle_operation_error(self, ec, operr, attach_tb=True):
     if attach_tb:
         if not we_are_jitted():
             # xxx this is a hack.  It allows bytecode_trace() to
             # call a signal handler which raises, and catch the
             # raised exception immediately.  See test_alarm_raise in
             # pypy/module/signal/test/test_signal.py.  Without the
             # next four lines, if an external call (like
             # socket.accept()) is interrupted by a signal, it raises
             # an exception carrying EINTR which arrives here,
             # entering the next "except" block -- but the signal
             # handler is then called on the next call to
             # dispatch_bytecode(), causing the real exception to be
             # raised after the exception handler block was popped.
             try:
                 trace = self.w_f_trace
                 self.w_f_trace = None
                 try:
                     ec.bytecode_trace(self)
                 finally:
                     self.w_f_trace = trace
             except OperationError, e:
                 operr = e
         pytraceback.record_application_traceback(
             self.space, operr, self, self.last_instr)
         if not we_are_jitted():
             ec.exception_trace(self, operr)
Example #3
0
    def _convert_unexpected_exception(self, e):
        from pypy.interpreter import error

        operr = error.get_converted_unexpected_exception(self.space, e)
        pytraceback.record_application_traceback(
            self.space, operr, self, self.last_instr)
        raise operr
Example #4
0
def PyTraceBack_Here(space, w_frame):
    from pypy.interpreter.pytraceback import record_application_traceback
    state = space.fromcache(State)
    if state.operror is None:
        return -1
    frame = space.interp_w(PyFrame, w_frame)
    record_application_traceback(space, state.operror, frame, 0)
    return 0
Example #5
0
def PyTraceBack_Here(space, w_frame):
    from pypy.interpreter.pytraceback import record_application_traceback
    state = space.fromcache(State)
    if state.operror is None:
        return -1
    frame = space.interp_w(PyFrame, w_frame)
    record_application_traceback(space, state.operror, frame, 0)
    return 0
Example #6
0
    def handle_operation_error(self, ec, operr, attach_tb=True):
        self.last_exception = operr
        if attach_tb:
            pytraceback.record_application_traceback(
                self.space, operr, self, self.last_instr)
            if not we_are_jitted():
                ec.exception_trace(self, operr)

        block = self.unrollstack(SApplicationException.kind)
        if block is None:
            # no handler found for the OperationError
            if we_are_translated():
                raise operr
            else:
                # try to preserve the CPython-level traceback
                import sys
                tb = sys.exc_info()[2]
                raise OperationError, operr, tb
        else:
            unroller = SApplicationException(operr)
            next_instr = block.handle(self, unroller)
            return next_instr
Example #7
0
    def handle_operation_error(self, ec, operr, attach_tb=True):
        self.last_exception = operr
        if attach_tb:
            pytraceback.record_application_traceback(self.space, operr, self,
                                                     self.last_instr)
            if not we_are_jitted():
                ec.exception_trace(self, operr)

        block = self.unrollstack(SApplicationException.kind)
        if block is None:
            # no handler found for the OperationError
            if we_are_translated():
                raise operr
            else:
                # try to preserve the CPython-level traceback
                import sys
                tb = sys.exc_info()[2]
                raise OperationError, operr, tb
        else:
            unroller = SApplicationException(operr)
            next_instr = block.handle(self, unroller)
            return next_instr