Skip to content

Allow nil output buffers for reader methods#3002

Open
Strech wants to merge 1 commit into
ruby:masterfrom
Strech:allow-nil-output-buffer-for-reader-methods
Open

Allow nil output buffers for reader methods#3002
Strech wants to merge 1 commit into
ruby:masterfrom
Strech:allow-nil-output-buffer-for-reader-methods

Conversation

@Strech

@Strech Strech commented Jun 17, 2026

Copy link
Copy Markdown

Ruby accepts explicit nil for output buffer arguments on reader methods and allocates a new String in that case. Update signatures and stdlib tests to match.

Updated signatures:

  • _Reader#read
  • _ReaderPartial#readpartial
  • IO#{pread,read_nonblock,readpartial,sysread}
  • ARGF#{read,read_nonblock,readpartial}
  • StringIO#{read,pread,read_nonblock,readpartial,sysread}
  • Zlib::GzipReader#read,readpartial
  • OpenSSL::Buffering#{read,read_nonblock,readpartial}
  • OpenSSL::SSL::SSLSocket#sysread

Ruby accepts explicit nil for output buffer arguments and allocates a
new String in that case. Update signatures and stdlib tests to match.

Updated signatures:

* _Reader#read
* _ReaderPartial#readpartial
* IO#{pread,read_nonblock,readpartial,sysread}
* ARGF#{read,read_nonblock,readpartial}
* StringIO#{read,pread,read_nonblock,readpartial,sysread}
* Zlib::GzipReader#read,readpartial
* OpenSSL::Buffering#{read,read_nonblock,readpartial}
* OpenSSL::SSL::SSLSocket#sysread
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