Commits

Anonymous committed 2f29fd1 Draft

line_profiler.py: don't fail at module docstrings (at least thats what I understand what happens)

  • Participants
  • Parent commits 0503e8b

Comments (0)

Files changed (1)

File line_profiler.py

             d[lineno] = (nhits, "%11.6f" % (time * unit), '%9.6f' % (float(time) * unit/ nhits), '%5.2f' % (100*time / total_time))
 
         all_lines = linecache.getlines(fn)
-        sublines = inspect.getblock(all_lines[start_lineno-1:])
+        try:
+            sublines = inspect.getblock(all_lines[start_lineno-1:])
+        except Exception, e:
+            sublines = all_lines
         linenos = range(start_lineno, start_lineno + len(sublines))
 
         dd = fn_map[fn]