Commits

Anonymous committed ec1a53c

BUG: Clear the linecache before getting lines.

  • Participants
  • Parent commits 71e4418

Comments (0)

Files changed (1)

File line_profiler.py

         nlines = max(linenos) - min(min(linenos), start_lineno) + 1
         sublines = [''] * nlines
     else:
+        # Clear the cache to ensure that we get up-to-date results.
+        linecache.clearcache()
         all_lines = linecache.getlines(filename)
         sublines = inspect.getblock(all_lines[start_lineno-1:])
     for lineno, nhits, time in timings: