Should only check frozen for Array#pop

This commit is contained in:
ksss
2017-07-09 18:05:21 +09:00
parent c76dc33116
commit bf48473cf6
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -451,7 +451,7 @@ mrb_ary_pop(mrb_state *mrb, mrb_value ary)
{
struct RArray *a = mrb_ary_ptr(ary);
ary_modify(mrb, a);
ary_modify_check(mrb, a);
if (a->len == 0) return mrb_nil_value();
return a->ptr[--a->len];
}
+2
View File
@@ -237,6 +237,8 @@ assert('Array#pop', '15.2.12.5.21') do
assert_nil([].pop)
assert_equal([1,2], a)
assert_equal(3, b)
assert_raise(RuntimeError) { [].freeze.pop }
end
assert('Array#push', '15.2.12.5.22') do