From: "YO4 (Yoshinao Muramatsu) via ruby-core" Date: 2025-11-13T16:58:34+00:00 Subject: [ruby-core:123792] [Ruby Misc#21684] Does IO#pos clear the buffer? Issue #21684 has been reported by YO4 (Yoshinao Muramatsu). ---------------------------------------- Misc #21684: Does IO#pos clear the buffer? https://bugs.ruby-lang.org/issues/21684 * Author: YO4 (Yoshinao Muramatsu) * Status: Open ---------------------------------------- I'm working on io.c and I'm confused by the difference between how the code looks and how it behaves. There is a function `io_unread(rb_io_t *fptr, bool discard_rbuf)` and this seems to discard buffer only if discard_rbuf is truthy. But they discards the buffer regardless of discard_rbuf in an ordinary code path. As a result the buffer is discarded when IO#pos is called. Is this intended? I checked #20869 and [DevMeeting-2024-11-07](https://github.com/ruby/dev-meeting-log/blob/master/2024/DevMeeting-2024-11-07.md), but I couldn't find a conclusion. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/