mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Add test for IO::Buffer.for(frozen_string) {}
and omit rb_str_{,un}locktmp in that case
This commit is contained in:
parent
83fb07fb2c
commit
2956573b09
Notes:
git
2025-06-16 20:59:21 +00:00
2 changed files with 16 additions and 2 deletions
|
@ -496,7 +496,9 @@ io_buffer_for_yield_instance(VALUE _arguments)
|
|||
|
||||
arguments->instance = io_buffer_for_make_instance(arguments->klass, arguments->string, arguments->flags);
|
||||
|
||||
rb_str_locktmp(arguments->string);
|
||||
if (!RB_OBJ_FROZEN(arguments->string)) {
|
||||
rb_str_locktmp(arguments->string);
|
||||
}
|
||||
|
||||
return rb_yield(arguments->instance);
|
||||
}
|
||||
|
@ -510,7 +512,9 @@ io_buffer_for_yield_instance_ensure(VALUE _arguments)
|
|||
rb_io_buffer_free(arguments->instance);
|
||||
}
|
||||
|
||||
rb_str_unlocktmp(arguments->string);
|
||||
if (!RB_OBJ_FROZEN(arguments->string)) {
|
||||
rb_str_unlocktmp(arguments->string);
|
||||
}
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue