Hide Forgot
Description of problem: Currently, python tracebacks shows the last of continuation lines when a function spans across multiple lines. This line usually contains some function parameter only and thus is not very useful for debugging the problem. For example: Traceback (most recent call last): File "./tcms-run", line 48, in <module> summary=options.summary) File "/home/psss/git/tcms/Nitrate.py", line 600, in __init__ raise NitrateError("Need either id or test plan") If the traceback contained the beginning of the continuation line it would be IMHO much more clear where/how the problem happened. Traceback (most recent call last): File "./tcms-run", line 48, in <module> run = TestRun(plan=plan, distro=options.distro, File "/home/psss/git/tcms/Nitrate.py", line 600, in __init__ raise NitrateError("Need either id or test plan") Version-Release number of selected component (if applicable): python-2.6.6-20.el6.x86_64 Trivial reproducer: def fun1(par): raise Exception def fun2(): fun1( par="value") fun2() Actual results: Traceback (most recent call last): File "/tmp/traceback.py", line 10, in <module> fun2() File "/tmp/traceback.py", line 8, in fun2 par="value") File "/tmp/traceback.py", line 4, in fun1 raise Exception Exception
The printing code in question is within Python/traceback.c It uses the tb->tb_lineno of a PyTracebackObject to determine which line to print, and tb_lineno is in fact exposed to Python code; see: http://docs.python.org/library/traceback.html It's set up in newtracebackobject (called by PyTraceBack_Here(PyFrameObject *frame)) based on the last bytecode being executed within the frame: PyCode_Addr2Line(frame->f_code, frame->f_lasti)
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.
OK, filed upstream as: http://bugs.python.org/issue12458