test_sys_settrace.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:zippy 作者: securesystemslab 项目源码 文件源码
def test_13_genexp(self):
        if self.using_gc:
            support.gc_collect()
            gc.enable()
        try:
            self.run_test(generator_example)
            # issue1265: if the trace function contains a generator,
            # and if the traced function contains another generator
            # that is not completely exhausted, the trace stopped.
            # Worse: the 'finally' clause was not invoked.
            tracer = Tracer()
            sys.settrace(tracer.traceWithGenexp)
            generator_example()
            sys.settrace(None)
            self.compare_events(generator_example.__code__.co_firstlineno,
                                tracer.events, generator_example.events)
        finally:
            if self.using_gc:
                gc.disable()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号