Repository navigation
Conversation
MRI's rb_f_readline calls ARGF.readline (argf_readline directly when the receiver is ARGF, otherwise forward). Kernel#readline called Kernel#gets and raised EOFError on nil, so a non-IO $stdin had its lines counted in ARGF.lineno and ARGF.readline overrides were ignored. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
zev
marked this pull request as ready for review
October 16, 2026 02:05
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.
Follow-up to #9785, as discussed there (headius: "I support both the Kernel.readline => ARGF move and the deprecation cleanups").
MRI's
rb_f_readlinecallsARGF.readline(argf_readlinedirectly when the receiver is ARGF, otherwiseforward). JRuby'sKernel#readlinecalledKernel#getsand raised EOFError onnil. That differs from MRI in two observable ways, both measured in this comment:jruby-10.0$stdin:readline; readline; [$., ARGF.lineno][0, 0][2, 2][0, 0]def ARGF.readline(*) = "patched\n"; readline"patched\n""a\n""patched\n"def ARGF.gets(*) = "patched\n"; readline"a\n""patched\n""a\n"The last row is the compatibility risk: code that stubs
ARGF.getsto feed a top-levelreadlinestops working, and code that stubsARGF.readlinestarts working. That is the CRuby behavior.Changes
RubyKernel.readlinemirrorsKernel#gets:RubyArgsFile.readlinewhenrecvis ARGF, otherwise a forwardedreadlinecall.KernelSitesgets areadlinecall site next togets.Kernel#readline calls ARGF.readline(fails onjruby-10.0with the mock never receivingreadline, passes here).Testing
mspec ciovercore/{kernel,argf,io}: 4503 examples, 2 failures. Those are the same twoKernel#require ... c-extension file exists but loading failsfailures as unmodifiedjruby-10.0.🤖 Generated with Claude Code