diff options
author | Benoit Daloze <[email protected]> | 2025-06-14 13:32:51 +0200 |
---|---|---|
committer | Benoit Daloze <[email protected]> | 2025-06-16 22:59:10 +0200 |
commit | 83fb07fb2c97b9922450979fa4a56f43324317a9 () | |
tree | f156eeadbfbe80578a9fa2d8bf7f0edc07f296c7 | |
parent | cce4bfdca9e001ccac38b4f3125627b5c0d0e9f2 (diff) |
[Bug #20998] Check if the string is frozen in rb_str_locktmp() & rb_str_unlocktmp()
Notes: Merged: https://.com/ruby/ruby/pull/13615
-rw-r--r-- | spec/ruby/optional/capi/string_spec.rb | 4 | ||||
-rw-r--r-- | string.c | 2 |
2 files changed, 4 insertions, 2 deletions
@@ -1222,7 +1222,7 @@ describe "C-API String function" do -> { str.upcase! }.should raise_error(RuntimeError, 'can\'t modify string; temporarily locked') end - ruby_bug "#20998", ""..."3.6" do # TODO: check when Ruby 3.5 is released it "raises FrozenError if string is frozen" do str = -"rb_str_locktmp" -> { @s.rb_str_locktmp(str) }.should raise_error(FrozenError) @@ -1246,7 +1246,7 @@ describe "C-API String function" do -> { @s.rb_str_unlocktmp(+"test") }.should raise_error(RuntimeError, 'temporal unlocking already unlocked string') end - ruby_bug "#20998", ""..."3.6" do # TODO: check when Ruby 3.5 is released it "raises FrozenError if string is frozen" do str = -"rb_str_locktmp" -> { @s.rb_str_unlocktmp(str) }.should raise_error(FrozenError) @@ -3664,6 +3664,7 @@ RUBY_ALIAS_FUNCTION(rb_str_dup_frozen(VALUE str), rb_str_new_frozen, (str)) VALUE rb_str_locktmp(VALUE str) { if (FL_TEST(str, STR_TMPLOCK)) { rb_raise(rb_eRuntimeError, "temporal locking already locked string"); } @@ -3674,6 +3675,7 @@ rb_str_locktmp(VALUE str) VALUE rb_str_unlocktmp(VALUE str) { if (!FL_TEST(str, STR_TMPLOCK)) { rb_raise(rb_eRuntimeError, "temporal unlocking already unlocked string"); } |