Source

line_profiler / line_profiler.py

Diff from to

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: