mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08:00
[Bug #21819] Data objects without members should also be frozen
This commit is contained in:
2 files changed
+2
Notes:
git
2026-01-03 06:45:26 +00:00
No files matched your search
@@ -1809,6 +1809,7 @@ rb_data_initialize_m(int argc, const VALUE *argv, VALUE self)
|
||||
if (num_members > 0) {
|
||||
rb_exc_raise(rb_keyword_error_new("missing", members));
|
||||
}
|
||||
OBJ_FREEZE(self);
|
||||
return Qnil;
|
||||
}
|
||||
if (argc > 1 || !RB_TYPE_P(argv[0], T_HASH)) {
|
||||
|
||||
@@ -262,6 +262,7 @@ class TestData < Test::Unit::TestCase
|
||||
assert_equal('#<data >', test.inspect)
|
||||
assert_equal([], test.members)
|
||||
assert_equal({}, test.to_h)
|
||||
assert_predicate(test, :frozen?)
|
||||
end
|
||||
|
||||
def test_dup
|
||||
|
||||
Reference in new issue
Block a user