diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/output/test_scope | 1 | ||||
-rw-r--r-- | Lib/test/test_scope.py | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/output/test_scope b/Lib/test/output/test_scope index fcd4e7a..1a44bb2 100644 --- a/Lib/test/output/test_scope +++ b/Lib/test/output/test_scope @@ -18,3 +18,4 @@ test_scope 17. class and global 18. verify that locals() works 19. var is bound and free in class +20. interaction with trace function diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index c42d881..fb53790 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -447,3 +447,23 @@ def f(x): inst = f(3)() verify(inst.a == inst.m()) + +print "20. interaction with trace function" + +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) |