Skip to content

IO: add fileno / to_i (synthetic descriptors) - #482

Merged
tannevaled merged 1 commit into
mainfrom
feat/io-fileno
Aug 29, 2026
Merged

tannevaled merged 1 commit into
mainfrom
feat/io-fileno

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

IO#fileno (and its #to_i alias) returns the stream's descriptor: the standard
streams report 0/1/2, and any other IO gets a distinct synthetic descriptor,
assigned on first request and stable thereafter. rbgo has no real OS file
descriptors, so this is an identity rather than a kernel fd, and it is defined
only on IO (not StringIO). A closed stream raises IOError.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
ratchet floor rises 16170 → 16180 (core/io fileno +2, new +7, plus open/for_fd,
zero regressions in a per-file sweep). The real-fd operations (IO.for_fd
round-trips) remain out of reach of the in-memory IO model.

🤖 Generated with Claude Code

IO#fileno (and its #to_i alias) returns the stream's descriptor: the standard
streams report 0/1/2, and any other IO gets a distinct synthetic descriptor,
assigned on first request and stable thereafter. rbgo has no real OS file
descriptors, so this is an identity rather than a kernel fd, and it is defined
only on IO (not StringIO). A closed stream raises IOError.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
floor rises 16170 -> 16180 (core/io fileno +2, new +7, plus open/for_fd). The
real-fd operations (IO.for_fd round-trips) remain out of reach of the in-memory
IO model.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 58d9e78 into main Aug 29, 2026
7 checks passed
@tannevaled
tannevaled deleted the feat/io-fileno branch August 29, 2026 14:20
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