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


Python traceback.walk_stack函数代码示例

本文整理汇总了Python中traceback.walk_stack函数的典型用法代码示例。如果您正苦于以下问题:Python walk_stack函数的具体用法?Python walk_stack怎么用?Python walk_stack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_walk_stack

 def test_walk_stack(self):
     def deeper():
         return list(traceback.walk_stack(None))
     s1 = list(traceback.walk_stack(None))
     s2 = deeper()
     self.assertEqual(len(s2) - len(s1), 1)
     self.assertEqual(s2[1:], s1)
开发者ID:Eyepea,项目名称:cpython,代码行数:7,代码来源:test_traceback.py

示例2: extract_stack

def extract_stack(f=None, limit=None):
    """Replacement for traceback.extract_stack() that only does the
    necessary work for asyncio debug mode.
    """
    if f is None:
        f = sys._getframe().f_back
    if limit is None:
        # Limit the amount of work to a reasonable amount, as extract_stack()
        # can be called for each coroutine and future in debug mode.
        limit = constants.DEBUG_STACK_DEPTH
    stack = traceback.StackSummary.extract(traceback.walk_stack(f),
                                           limit=limit,
                                           lookup_lines=False)
    stack.reverse()
    return stack
开发者ID:1st1,项目名称:cpython,代码行数:15,代码来源:format_helpers.py

示例3: f

def f():
    summary = traceback.StackSummary.extract(
        traceback.walk_stack(None)
    )
    print(''.join(summary.format()))
开发者ID:robertopauletto,项目名称:PyMOTW-it_3.0,代码行数:5,代码来源:traceback_stacksummary.py

示例4: some_inner

 def some_inner(k, v):
     a = 1
     b = 2
     return traceback.StackSummary.extract(
         traceback.walk_stack(None), capture_locals=True, limit=1)
开发者ID:invisiblek,项目名称:android_external_python,代码行数:5,代码来源:test_traceback.py

示例5: test_extract_stack_limit

 def test_extract_stack_limit(self):
     s = traceback.StackSummary.extract(traceback.walk_stack(None), limit=5)
     self.assertEqual(len(s), 5)
开发者ID:invisiblek,项目名称:android_external_python,代码行数:3,代码来源:test_traceback.py

示例6: test_extract_stack

 def test_extract_stack(self):
     s = traceback.StackSummary.extract(traceback.walk_stack(None))
     self.assertIsInstance(s, traceback.StackSummary)
开发者ID:invisiblek,项目名称:android_external_python,代码行数:3,代码来源:test_traceback.py

示例7: test_walk_stack

 def test_walk_stack(self):
     s = list(traceback.walk_stack(None))
     self.assertGreater(len(s), 10)
开发者ID:invisiblek,项目名称:android_external_python,代码行数:3,代码来源:test_traceback.py

示例8: f

def f():
    summary = traceback.StackSummary.extract(
        traceback.walk_stack(None)
    )
    for fs in summary:
        print(template.format(fs=fs))
开发者ID:jasonwee,项目名称:asus-rt-n14uhp-mrtg,代码行数:6,代码来源:traceback_framesummary.py

示例9: deeper

 def deeper():
     return list(traceback.walk_stack(None))
开发者ID:Eyepea,项目名称:cpython,代码行数:2,代码来源:test_traceback.py


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