[Python-checkins] r73206 - python/trunk/Lib/traceback.py

georg.brandl python-checkins at python.org
Thu Jun 4 11:15:12 CEST 2009


Author: georg.brandl
Date: Thu Jun 4 11:15:12 2009
New Revision: 73206
Log:
#3584: ignore trailing newlines when placing the caret for a SyntaxError location.
Modified:
 python/trunk/Lib/traceback.py
Modified: python/trunk/Lib/traceback.py
==============================================================================
--- python/trunk/Lib/traceback.py	(original)
+++ python/trunk/Lib/traceback.py	Thu Jun 4 11:15:12 2009
@@ -189,7 +189,7 @@
 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


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /