Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r93117:e37a09d8450a
Date: 2017-11-21 18:38 +0000
http://bitbucket.org/pypy/pypy/changeset/e37a09d8450a/
Log: Fix traceback.print_exception() when exc.offset == 0
diff --git a/lib-python/3/traceback.py b/lib-python/3/traceback.py
--- a/lib-python/3/traceback.py
+++ b/lib-python/3/traceback.py
@@ -544,8 +544,8 @@
yield ' {}\n'.format(badline.strip())
if offset is not None:
caretspace = badline.rstrip('\n')
- offset = min(len(caretspace), offset) - 1
- caretspace = caretspace[:offset].lstrip()
+ # bug in CPython: the case offset==0 is mishandled
+ caretspace = caretspace[:offset].lstrip()[:-1]
# non-space whitespace (likes tabs) must be kept for alignment
caretspace = ((c.isspace() and c or ' ') for c in caretspace)
yield ' {}^\n'.format(''.join(caretspace))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit