Skip to content

Commit 4ccbffe

Browse files
fix: combine conditions in line_profiler_step to avoid returning empty dict for all TestResults
The return statement was outside the inner if-not block, causing all TestResults (even populated ones) to return an empty dict. Co-authored-by: Kevin Turcios <KRRT7@users.noreply.github.com>
1 parent 192cf0f commit 4ccbffe

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

codeflash/languages/python/function_optimizer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,10 @@ def line_profiler_step(
177177
self.write_code_and_helpers(
178178
self.function_to_optimize_source_code, original_helper_code, self.function_to_optimize.file_path
179179
)
180-
if isinstance(line_profile_results, TestResults):
181-
if not line_profile_results.test_results:
182-
logger.warning(
183-
f"Timeout occurred while running line profiler for original function {self.function_to_optimize.function_name}"
184-
)
180+
if isinstance(line_profile_results, TestResults) and not line_profile_results.test_results:
181+
logger.warning(
182+
f"Timeout occurred while running line profiler for original function {self.function_to_optimize.function_name}"
183+
)
185184
return {"timings": {}, "unit": 0, "str_out": ""}
186185
if line_profile_results["str_out"] == "":
187186
logger.warning(

0 commit comments

Comments
 (0)