#!/usr/bin/env python import inspect, linecache, sys def tracer(frame, event, arg): global z (filename, line_no) = inspect.getframeinfo(frame)[0:2] print "Event %s at line %d:" % (event, line_no) print "\t", linecache.getline(filename, line_no), print "----------------------" try: if z == 0: if line_no == 4: print "***We jumped back to line 4 but should have gone to 2**" sys.exit(1) frame.f_lineno = 2 # And 3 is broken too. except NameError: pass return tracer # This helps emacs figure indentation out sys.settrace(tracer) execfile("jumpbug2.py")