Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/pipeline/pass_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1789,15 +1789,25 @@ void cbm_pipeline_pass_fastapi_depends(cbm_pipeline_ctx_t *ctx, const cbm_file_i
break;
}

CBMFileResult *result = ctx->result_cache ? ctx->result_cache[i] : NULL;
bool loaded_spill = false;
CBMFileResult *result =
ctx->result_cache
? cbm_pipeline_result_acquire(ctx, ctx->result_cache, i, NULL, &loaded_spill)
: NULL;
if (!result || !file_has_depends_call(result)) {
if (loaded_spill && result) {
cbm_free_result(result);
}
continue;
}

/* Read source and scan for Depends(func_ref) in function signatures */
int source_len = 0;
char *source = read_file(files[i].path, &source_len);
if (!source) {
if (loaded_spill) {
cbm_free_result(result);
}
continue;
}

Expand Down Expand Up @@ -1830,6 +1840,9 @@ void cbm_pipeline_pass_fastapi_depends(cbm_pipeline_ctx_t *ctx, const cbm_file_i
free(module_qn);
free_import_map(imp_keys, imp_vals, imp_count);
free(source);
if (loaded_spill) {
cbm_free_result(result);
}
}

cbm_regfree(&depends_re);
Expand Down
4 changes: 4 additions & 0 deletions src/pipeline/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -3179,6 +3179,10 @@ static int run_parallel_pipeline(cbm_pipeline_t *p, cbm_pipeline_ctx_t *ctx,
free(def_modules);
}
cbm_pipeline_sync_next_id(p->gbuf, &shared_ids);
/* Issue #2945 fix: run FastAPI Depends() pass on the parallel pipeline path too */
ctx->result_cache = cache;
cbm_pipeline_pass_fastapi_depends(ctx, files, file_count);
ctx->result_cache = NULL;
cbm_pipeline_extract_infra_routes(ctx, p->gbuf, files, cache, file_count);
cbm_pipeline_process_infra_bindings(ctx, p->gbuf, files, cache, file_count);
for (int i = 0; i < file_count; i++) {
Expand Down
Loading