diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-21 20:29:18 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-03-21 20:29:18 (GMT) |
commit | ed9d0ba48242e8a0b1b6942c489da28e7025cd4b (patch) | |
tree | 298d800f7eed528dedfcd6a01bd8024c7bb584e9 /Lib | |
parent | 6783070ebfa77aeaf7b5db758095e93cf8e2635c (diff) | |
download | cpython-ed9d0ba48242e8a0b1b6942c489da28e7025cd4b.zip cpython-ed9d0ba48242e8a0b1b6942c489da28e7025cd4b.tar.gz cpython-ed9d0ba48242e8a0b1b6942c489da28e7025cd4b.tar.bz2 |
Do not print caret when offset is None.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/traceback.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/traceback.py b/Lib/traceback.py index f887c05..82906a3 100644 --- a/Lib/traceback.py +++ b/Lib/traceback.py @@ -175,13 +175,14 @@ def format_exception_only(etype, value): while i < len(line) and line[i].isspace(): i = i+1 list.append(' %s\n' % line.strip()) - s = ' ' - for c in line[i:offset-1]: - if c.isspace(): - s = s + c - else: - s = s + ' ' - list.append('%s^\n' % s) + if offset is not None: + s = ' ' + for c in line[i:offset-1]: + if c.isspace(): + s = s + c + else: + s = s + ' ' + list.append('%s^\n' % s) value = msg s = _some_str(value) if s: |