Skip to content

fix(benchmarks): prevent csv correctness harness from crashing on rai…#589

Open
adiraj66132 wants to merge 2 commits into
DietrichGebert:mainfrom
adiraj66132:fix/csv-harness-crash
Open

fix(benchmarks): prevent csv correctness harness from crashing on rai…#589
adiraj66132 wants to merge 2 commits into
DietrichGebert:mainfrom
adiraj66132:fix/csv-harness-crash

Conversation

@adiraj66132

Copy link
Copy Markdown

Summary

The csv() correctness harness in benchmarks/correctness.js crashed with
AttributeError: '_io.TextIOWrapper' object has no attribute 'getvalue'
whenever the generated code raised inside its try: block. The except
branch restored sys.stdout to the real stream, then the next line called
.getvalue() on it — so the real error was swallowed and masked by a
misleading Python traceback.

Fix

Keep a reference to the captured StringIO buffer (_captured) and emit a
clean FAIL on exception instead of silently pass-ing.

Test plan

  • A correct non-pandas CSV implementation still scores pass (351).
  • Generated CSV code that raises now returns a clean fail instead of crashing.

The test required pandas, which isn't always available locally; the
correctness harness is generic, so a stdlib csv one-liner exercises the
same gate logic without an external dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant