Repository navigation
StringIO / buffer IO: advance MRI 4.0.6 conformance - #561
Merged
Merged
Conversation
…limit) Committed to protect against scratchpad purge; to be finished, verified and squashed before the PR is opened. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ode+seek fixes Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…dual tests Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tra (fix coverage) The per-StringIO close_read/close_write overrides shadowed defIOReadExtra's, leaving those closures uncovered (89.4%). Move the rdModeOff/wrModeOff IOError guard into the single shared definition (only StringIO sets those fields), removing the shadow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # internal/vm/vm.go
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.
Advances MRI Ruby 4.0.6 (stringio 3.2.0) conformance for the in-memory StringIO / buffer-backed IO paths, entirely CGO-free. Work is confined to
internal/vm/io.go(+ one post-prelude hook line invm.go) and a newinternal/vm/stringio_residuals_test.go; no OS-fd, socket, pipe, select, or subprocess paths were touched.What changed
StringIO.allocatenow yields a real StringIO backend;#initializeis a private instance method;.newand.openshare the same setup..openwith a block yields self, then closes it and drops the backing string (#string⇒ nil), even on exception.#stringreturns that same object and writes/truncation are visible through it (matching MRI).#reopen(String / StringIO /#to_strio/ two-arg mode forms),#string=,#each_codepoint.IO::WRONLYno longer truncates;IO::TRUNC/O_APPENDhonored); frozen backing string raisesErrno::EACCES(writable mode) orFrozenError(truncating mode);:mode/:binmode/:textmode/:encodingoptions with conflict detection.#seek/#pos=/#truncatetake#to_int, raiseErrno::EINVALon negative/bad-whence,IOErroron closed/unwritable;#rewindresets lineno.#syncalways true,#binmodesets ASCII-8BIT,#close_read/#close_writeraiseIOErroron the wrong mode,#fcntl⇒ NotImplementedError; true aliases#size/#tell/#eof/#isatty;StringIO::VERSION= "3.2.0"; StringIO mixes in Enumerable.Conformance deltas (rubyspec, vs main)
Notable per-spec: initialize 3→26, open 0→20, reopen 0→29, each_codepoint 0→7, string 2→7, seek 4→8, truncate 6→9, sync 0→2, plus binmode/close_read/close_write/eof/isatty/size/tell/fcntl/read/sysread/stringio.
Remaining failures are encoding-subsystem (default_external / string-encoding tracking), overwrite-semantics
#ungetc/#ungetbyte, and OS-dependent fd/nonblock paths — reported, not in scope for the buffer subset.Gates
go test ./internal/vm/andgo test ./...green.gofmt -lclean.-coverpkgprofile; no shadowed dead code (methods edited in place / overridden per-class), every new branch tested. The one sub-100% line is a pre-existingsetLineGlobalsnil-guard insidedefStringIORead, byte-identical to main and unreachable via the public API.🤖 Generated with Claude Code