mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
#3584: ignore trailing newlines when placing the caret for a SyntaxError location.
This commit is contained in:
parent
e6632b47bb
commit
eb56aa169a
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue