test_scope.py 文件源码

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

项目:oil 作者: oilshell 项目源码 文件源码
def testInteractionWithTraceFunc(self):

        import sys
        def tracer(a,b,c):
            return tracer

        def adaptgetter(name, klass, getter):
            kind, des = getter
            if kind == 1:       # AV happens when stepping from this line to next
                if des == "":
                    des = "_%s__%s" % (klass.__name__, name)
                return lambda obj: getattr(obj, des)

        class TestClass:
            pass

        sys.settrace(tracer)
        adaptgetter("foo", TestClass, (1, ""))
        sys.settrace(None)

        self.assertRaises(TypeError, sys.settrace)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号