From: Jeremy Hylton Date: Wed, 21 Mar 2001 20:29:18 +0000 (+0000) Subject: Do not print caret when offset is None. X-Git-Tag: v2.1b2~101 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed9d0ba48242e8a0b1b6942c489da28e7025cd4b;p=thirdparty%2FPython%2Fcpython.git Do not print caret when offset is None. --- diff --git a/Lib/traceback.py b/Lib/traceback.py index f887c0587391..82906a325f05 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: