Description
When a function call is split across several source lines, line_profiler reports twice as many hits on the opening f( line as there are actual executions of that call.
Reproducer
from line_profiler import LineProfiler
def main() -> None:
for _ in range(100):
print(
1,
)
if __name__ == "__main__":
profile = LineProfiler(main)
profile.runcall(main)
profile.print_stats()
Output
Line # Hits Time Per Hit % Time Line Contents
==============================================================
2 def main() -> None:
3 101 16000.0 158.4 9.0 for _ in range(100):
4 200 152000.0 760.0 85.9 print(
5 100 9000.0 90.0 5.1 1,
6 )
Expectation
print must show 100 hits not 200
Note
Happy to open a PR if maintainers allow me to do so.
Description
When a function call is split across several source lines,
line_profilerreports twice as many hits on the openingf(line as there are actual executions of that call.Reproducer
Output
Expectation
printmust show 100 hits not 200Note
Happy to open a PR if maintainers allow me to do so.