diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-03-24 14:27:16 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-03-24 14:49:12 +0900 |
| commit | 3cd6323fbb2e054ee2cef28b2c1abef40db36354 (patch) | |
| tree | dc46b155ada51e35299de4bc780d1a8e111ecb08 | |
| parent | 930edc12d75ff8f496751e2e33416b259d1deafc (diff) | |
merge revision(s) d7a6ff8224519005d2deeb3f4e98689a8a0835ad: [Backport #21819]
[Bug #21819] Data objects without members should also be frozen
| -rw-r--r-- | struct.c | 1 | ||||
| -rw-r--r-- | test/ruby/test_data.rb | 1 | ||||
| -rw-r--r-- | version.h | 2 |
3 files changed, 3 insertions, 1 deletions
@@ -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 @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 10 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 202 +#define RUBY_PATCHLEVEL 203 #include "ruby/version.h" #include "ruby/internal/abi.h" |
