Do not print caret when offset is None.
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 @@
                 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: