Raise instead of silent success: closed-channel send, missing load_file path, missing expression (#505, #490, #494)#518
Merged
Conversation
…ng load_file path, and missing expression (#505, #490, #494) Silent-tolerance audit batch-2d. Three paths that returned a silent wrong value with rc=0 now raise a catchable error: - send to a closed channel raised nothing and dropped the value (a producer racing a consumer's close lost messages). Now raises a catchable `value` error; the enqueue path unlocks before returning and the closed path unlocks -> decref -> rt_error (never rt_error under the channel mutex). recv on a closed empty channel still returns null. (#505) - load_file of a missing/unreadable path printed to stderr and returned a silent null; now raises a catchable `io` error, matching import's severity and the function's own parse/compile failure paths. (#490) - the parser folded a missing expression after is/of/unary or as a throw/print argument (x is, print of, throw of, eval of "x is ") into a silent null and continued. parse_primary now raises "expected expression" on a statement terminator; bare `return` (the one legitimate empty-expression position) checks the terminator itself and still yields null. (#494) Tests: batch-2d cases + eval-catchable parse in test_raise_on_bad_input ([116], count 43->48), new examples/errors/missing_expression.eigs ([90]). Docs: BUILTINS.md (send/load_file), CHANGELOG. Release + ASan/leak suites 2683/2683, leak-clean. Closes #505 Closes #490 Closes #494 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Silent-tolerance audit batch-2d. Three paths that returned a silent wrong value with
rc=0now raise a catchable error from the closed error-kind set. Each was reproduced first, fixed, and given a regression test.Fixes
sendto a closed channel silently dropped the value. A producer that raced a consumer'sclose_channellost messages with no signal. Now raises a catchablevalueerror. Lock discipline: the enqueue path unlocks before returning; the closed path unlocks →val_decref→rt_error(never callsrt_errorwhile holding the channel mutex).recvon a closed empty channel still returnsnull(EOF-like — intended).load_fileof a missing/unreadable path returned a silentnull(stderr warn +rc=0). Now raises a catchableioerror, matchingimport's severity and the function's own parse/compile failure paths.null.x is,print of,throw of,eval of "x is "bound/emittednulland continued withrc=0.parse_primarynow raisesParse error line N: expected expressionon a statement terminator (catchableparseviaeval/import/load_file). Barereturn— the one legitimate empty-expression position — checks the terminator itself and still yieldsnull.Tests
test_raise_on_bad_input.eigs[116]: batch-2d cases + eval-catchable parse (count 43→48).examples/errors/missing_expression.eigs[90] (direct-sourcerc=1).BUILTINS.md(send/load_filerows),CHANGELOG.md.Validation
detect_leaks=1: 2683/2683, 0 failed, leak tally clean.Closes #505
Closes #490
Closes #494
🤖 Generated with Claude Code