[issue6962] traceback.format_exception_only does not return SyntaxError carot correctly
thewtex
report at bugs.python.org
Wed Oct 7 22:16:53 CEST 2009
thewtex <matt at mmmccormick.com> added the comment:
Sorry about the lack of the attached file. I will try again and include
it inline.
That other patch does not fix the bug I am seeing, which is experienced
while using traceback.format_exception_only directly.
Thanks.
--- /usr/lib/python2.6/traceback.py 2009-09-23 19:49:17.000000000 -0500
+++ /home/matt/tmp/traceback.py 2009-09-21 17:09:49.590440613 -0500
@@ -190,11 +190,10 @@
if badline is not None:
lines.append(' %s\n' % badline.strip())
if offset is not None:
- caretspace = badline[:offset].lstrip()
+ caretspace = badline[:offset-1].lstrip()
# non-space whitespace (likes tabs) must be kept for
alignment
caretspace = ((c.isspace() and c or ' ') for c in
caretspace)
- # only three spaces to account for offset1 == pos 0
- lines.append(' %s^\n' % ''.join(caretspace))
+ lines.append(' %s^\n' % ''.join(caretspace))
value = msg
lines.append(_format_final_exc_line(stype, value))
----------
keywords: +patch
status: closed -> open
Added file: http://bugs.python.org/file15074/traceback.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6962>
_______________________________________
More information about the Python-bugs-list
mailing list