]> granicus.if.org Git - python/commitdiff
Do not print caret when offset is None.
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 21 Mar 2001 20:29:18 +0000 (20:29 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 21 Mar 2001 20:29:18 +0000 (20:29 +0000)
Lib/traceback.py

index f887c05873918d11dd5696237a9b5c1c6a9eb2d8..82906a325f059c1eac4779b0904a1e75829fd13a 100644 (file)
@@ -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: