summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/traceback.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py
index 86a2c06b3c..8d28afc0cd 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