Skip to content

Fix dumping StringIO (and potentially others) on Ruby <= 2.7 #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025

Conversation

Earlopain
Copy link
Contributor

In Ruby < 3.0, the superclass of StringIO was actually already Data, but it doesn't have the expected shape. So, on these earlier versions it errors:

NoMethodError: undefined method members' for #<StringIO:0x00005641dd5f2880> vendor/bundle/ruby/2.6.0/gems/psych-5.2.5/lib/psych/visitors/yaml_tree.rb:170:in visit_Data'

This test doesn't fail on 2.7, presumably because it can pull in a newer stringio version.

Some context: https://bugs.ruby-lang.org/issues/3072

Here's a test failure before the fix: https://github.com/Earlopain/psych/actions/runs/14976611657/job/42070451324

In Ruby < 3.0, the superclass of StringIO was actually already `Data`,
but it doesn't have the expected shape. So, on these earlier versions it errors:
> NoMethodError: undefined method `members' for #<StringIO:0x00005641dd5f2880>
>    vendor/bundle/ruby/2.6.0/gems/psych-5.2.5/lib/psych/visitors/yaml_tree.rb:170:in `visit_Data'

This test doesn't fail on 2.7, presumably because it can pull in a newer `stringio` version.
@byroot byroot merged commit 405fae0 into ruby:master May 12, 2025
63 of 74 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.

2 participants