Project

General

Profile

Actions

Misc #21684

open

Does IO#pos clear the buffer?

Misc #21684: Does IO#pos clear the buffer?

Added by YO4 (Yoshinao Muramatsu) about 14 hours ago.

Status:
Open
Assignee:
-
[ruby-core:123792]

Description

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, but I couldn't find a conclusion.

No data to display

Actions

Also available in: PDF Atom