summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2026-01-25 17:47:37 +0900
committernagachika <nagachika@ruby-lang.org>2026-01-25 17:47:37 +0900
commitd5ca99a71ccb170db08e4b610d661ce3a18626f2 (patch)
treeaae2e0141bf531e0fb61f62ea12c816399dbee8b
parent8fa17ea3b2c857369c808a4384ff7ff8174d69f8 (diff)
merge revision(s) d7a6ff8224519005d2deeb3f4e98689a8a0835ad: [Backport #21819]
[PATCH] [Bug #21819] Data objects without members should also be frozen
-rw-r--r--struct.c1
-rw-r--r--test/ruby/test_data.rb1
-rw-r--r--version.h2
3 files changed, 3 insertions, 1 deletions
diff --git a/struct.c b/struct.c
index 4cd4c60452..efe6fc649f 100644
--- a/struct.c
+++ b/struct.c
@@ -1785,6 +1785,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)) {
diff --git a/test/ruby/test_data.rb b/test/ruby/test_data.rb
index dd698fdcc4..5ac4c6b84b 100644
--- a/test/ruby/test_data.rb
+++ b/test/ruby/test_data.rb
@@ -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
diff --git a/version.h b/version.h
index 9787f2b286..304bcfa8ca 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 8
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 78
+#define RUBY_PATCHLEVEL 79
#include "ruby/version.h"
#include "ruby/internal/abi.h"