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
Explicit handling of frozen strings in IO::Buffer#for
.
#5892
Explicit handling of frozen strings in IO::Buffer#for
.
#5892
Conversation
565f6d7
to
68e58a4
Compare
|
68e58a4
to
311f6ac
Compare
311f6ac
to
7f2dbb0
Compare
@soutaro looks good now! |
Is the backport label on GitHub enough? Or should we create a Redmine ticket (asking because a colleague just ran into this bug). |
@casperisfine All backport requests should be submitted as closed bugs on Redmine with the appropriate backport field set to REQUIRED for the ruby versions you would like the fix backported to. |
@jeremyevans thank you for confirming, that's what I remembered. I'll create the backport issue then. |
…Backport #18775] Explicit handling of frozen strings in `IO::Buffer#for`. (#5892) --- io_buffer.c | 122 +++++++++++++++++++++++++++++++++++--------- test/ruby/test_io_buffer.rb | 36 +++++++------ 2 files changed, 117 insertions(+), 41 deletions(-) Fix rdoc of IO::Buffer [ci skip] --- io_buffer.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
It turns out that we can't touch attributes during GC free, so unlocking the buffer's source during GC is undefined (in a bad way). So, we change the API for
IO::Buffer#for
slightly to avoid this case. It still works in the scenarios we expect, e.g.Defining global constant buffers: