Kaydet (Commit) 61328eef authored tarafından Jeffrey Yasskin's avatar Jeffrey Yasskin

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.
üst fceb5d47
......@@ -471,7 +471,7 @@ class JumpTracer:
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:
......
......@@ -127,7 +127,8 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
if (!f->f_trace)
{
PyErr_Format(PyExc_ValueError,
"f_lineno can only be set by a trace function");
"f_lineno can only be set by a"
" line trace function");
return -1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment