From ed9d0ba48242e8a0b1b6942c489da28e7025cd4b Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 21 Mar 2001 20:29:18 +0000 Subject: Do not print caret when offset is None. --- Lib/traceback.py | 15 ++++++++------- 1 file 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: -- cgit v0.12