docs: add Coming-from-Python section + fix stale counts - #2
Conversation
…the process Writing to a socket whose peer has closed delivered SIGPIPE, whose default disposition terminates the whole process (exit 141) before send() could return EPIPE — so the existing `n <= 0 -> raise` error path in _send_all never ran. CPython dodges this by installing SIG_IGN for SIGPIPE at startup; a Mojo process does not. Suppress the signal at the syscall boundary, platform-gated: - Linux: pass MSG_NOSIGNAL (0x4000) in the send() flags. - macOS/BSD: set SO_NOSIGPIPE via setsockopt(2) right after socket() (there is no MSG_NOSIGNAL). Platform chosen at comptime via CompilationTarget. A dead peer now raises a catchable Error. Added test/test_connection.mojo, a self-contained regression test (stands up its own loopback peer via FFI, no Redis server) wired into CI, so it exercises the Linux MSG_NOSIGNAL path on the ubuntu runner. Against the unfixed code this test terminates the test binary with signal 13 (exit 141); with the fix it passes. Also fixes a build-blocking pixi pin: `mojo = ">=1.0.0b3"` sorts after the dev nightlies (1.0.0b3.dev…) so `pixi install` found no candidates; pinned to `>=1.0.0b3.dev0,<2`. Co-Authored-By: Claude <noreply@anthropic.com>
Adds a "Coming from Python" on-ramp table (verified against the repo's own examples/ and tests) and corrects suite/test-count accuracy issues. Co-Authored-By: Claude <noreply@anthropic.com>
The SIGPIPE/DoS/pixi code + its CHANGELOG entries belong to the security fix PR; this branch is docs (Coming-from-Python + test count) only. Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 Independent Claude review: Ready. Verified every Mojo snippet in the diff against real source — no invented APIs. "Coming from Python" table — all methods exist in
Counts:
Python-side snippets are idiomatic redis-py ( No blocking issues. |
|
Docs review (sonnet): SHIP redis-py-shaped table ( |
Summary
Two documentation changes:
the intro) mapping the familiar Python API to this library's real API.
Every snippet was extracted from this repo's own
examples/andtest/;nothing was invented.
Test counts were re-verified by actually counting the test functions in the
repo (not trusting the prior text).
From an automated review (personal-context#62); drafted by Claude Code — please review the Coming-from-Python snippets for API accuracy.