当前位置: 首页>>代码示例>>Python>>正文


Python OperationError.application_traceback方法代码示例

本文整理汇总了Python中pypy.interpreter.error.OperationError.application_traceback方法的典型用法代码示例。如果您正苦于以下问题:Python OperationError.application_traceback方法的具体用法?Python OperationError.application_traceback怎么用?Python OperationError.application_traceback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.interpreter.error.OperationError的用法示例。


在下文中一共展示了OperationError.application_traceback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RAISE_VARARGS

# 需要导入模块: from pypy.interpreter.error import OperationError [as 别名]
# 或者: from pypy.interpreter.error.OperationError import application_traceback [as 别名]
    def RAISE_VARARGS(f, nbargs, *ignored):
        space = f.space
        if nbargs == 0:
            operror = space.getexecutioncontext().sys_exc_info()
            if operror is None:
                raise OperationError(space.w_TypeError,
                    space.wrap("raise: no active exception to re-raise"))
            # re-raise, no new traceback obj will be attached
            f.last_exception = operror
            raise Reraise

        w_value = w_traceback = space.w_None
        if nbargs >= 3: w_traceback = f.popvalue()
        if nbargs >= 2: w_value     = f.popvalue()
        if 1:           w_type      = f.popvalue()
        operror = OperationError(w_type, w_value)
        operror.normalize_exception(space)
        if not space.full_exceptions or space.is_w(w_traceback, space.w_None):
            # common case
            raise operror
        else:
            tb = space.interpclass_w(w_traceback)
            if tb is None or not space.is_true(space.isinstance(tb, 
                space.gettypeobject(pytraceback.PyTraceback.typedef))):
                raise OperationError(space.w_TypeError,
                      space.wrap("raise: arg 3 must be a traceback or None"))
            operror.application_traceback = tb
            # re-raise, no new traceback obj will be attached
            f.last_exception = operror
            raise Reraise
开发者ID:antoine1fr,项目名称:pygirl,代码行数:32,代码来源:pyopcode.py

示例2: w_throw

# 需要导入模块: from pypy.interpreter.error import OperationError [as 别名]
# 或者: from pypy.interpreter.error.OperationError import application_traceback [as 别名]
 def w_throw(self, w_type=None, w_value=None, w_traceback=None):
     space = self.space
     if space.is_w(w_type, space.w_None):
         w_type = self.costate.w_GreenletExit
     # Code copied from RAISE_VARARGS but slightly modified.  Not too nice.
     operror = OperationError(w_type, w_value)
     operror.normalize_exception(space)
     if not space.is_w(w_traceback, space.w_None):
         from pypy.interpreter import pytraceback
         tb = space.interpclass_w(w_traceback)
         if tb is None or not space.is_true(space.isinstance(tb, 
             space.gettypeobject(pytraceback.PyTraceback.typedef))):
             raise OperationError(space.w_TypeError,
                   space.wrap("throw: arg 3 must be a traceback or None"))
         operror.application_traceback = tb
     # Dead greenlet: turn GreenletExit into a regular return
     if self.isdead() and operror.match(space, self.costate.w_GreenletExit):
         args_w = [operror.w_value]
     else:
         syncstate.push_exception(operror)
         args_w = None
     return self.w_switch(args_w)
开发者ID:enyst,项目名称:plexnet,代码行数:24,代码来源:interp_greenlet.py


注:本文中的pypy.interpreter.error.OperationError.application_traceback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。