diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index b5db9a7a01f..a8f51638399 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -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: diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 7a9d40d8965..5e54585f67b 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -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; }