diff options
author | Georg Brandl <georg@python.org> | 2009-06-04 09:15:12 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-06-04 09:15:12 (GMT) |
commit | eb56aa169a7af96254118fc47aa37df1da023987 (patch) | |
tree | e7279c6363b54bf154c23b939bd5cadab1f35127 /Lib/traceback.py | |
parent | e6632b47bbb0df00f67160b7497923e2f746d57b (diff) | |
download | cpython-eb56aa169a7af96254118fc47aa37df1da023987.zip cpython-eb56aa169a7af96254118fc47aa37df1da023987.tar.gz cpython-eb56aa169a7af96254118fc47aa37df1da023987.tar.bz2 |
#3584: ignore trailing newlines when placing the caret for a SyntaxError location.
Diffstat (limited to 'Lib/traceback.py')
-rw-r--r-- | Lib/traceback.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py index 86a2c06..8d28afc 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -189,7 +189,7 @@ def format_exception_only(etype, value): if badline is not None: lines.append(' %s\n' % badline.strip()) if offset is not None: - caretspace = badline[:offset].lstrip() + caretspace = badline.rstrip('\n')[:offset].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 |