Skip to content

Conversation

@herwinw
Copy link
Member

@herwinw herwinw commented Aug 3, 2025

… to StringIO#readpartial

This one was missing in #1278, I got it to work with the encoding: binary directive. The StringIO code was fine, the spec was just incomplete.

@@ -1,3 +1,4 @@
# encoding: binary
Copy link
Member

@andrykonchin andrykonchin Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we can avoid this just by converting string literals to binary encoding explicitly:

    @string.readpartial(3).should == "\xE2\x88\x82".b
    @string.readpartial(3).should == "\xCF\x86/".b

Does it look better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that seems a bit better, I'll try it.
There used to be an issue that the parser gem couldn't parse such things but it probably matters much less now that Prism can be used instead.

… to StringIO#readpartial

This one was missing in ruby#1278, I got it to work with the
`encoding: binary` directive. The StringIO code was fine, the spec was
just incomplete.
@eregon eregon force-pushed the stringio_readpartial branch from 632378a to 261038f Compare January 4, 2026 12:23
@eregon eregon merged commit 99c2b75 into ruby:master Jan 4, 2026
12 of 13 checks passed
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.

3 participants