diff Lib/test/test_trace.py @ 54199:d8350d044cf2 legacy-trunk

While I was modifying test_trace, it threw an exception when I accidentally made it try to set the line number from the trace callback for a 'call' event. This patch makes the error message a little more helpful in that case, and makes it a little less likely that a future editor will make the same mistake in test_trace.
author Jeffrey Yasskin <jyasskin@gmail.com>
date Mon, 18 May 2009 21:14:54 +0000
parents 95947fdf40ae
children 4ceeefb8555e
line wrap: on
line diff
--- a/Lib/test/test_trace.py	Mon May 18 15:51:59 2009 +0000
+++ b/Lib/test/test_trace.py	Mon May 18 21:14:54 2009 +0000
@@ -471,7 +471,7 @@
     def trace(self, frame, event, arg):
         if not self.done and frame.f_code == self.function.func_code:
             firstLine = frame.f_code.co_firstlineno
-            if frame.f_lineno == firstLine + self.jumpFrom:
+            if event == 'line' and frame.f_lineno == firstLine + self.jumpFrom:
                 # Cope with non-integer self.jumpTo (because of
                 # no_jump_to_non_integers below).
                 try: