1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Skip freezing check on setting temporary class path [Bug #17563]

Co-authored-by: ryannevell (Ryan Nevell) <ryan.nevell@gmail.com>
This commit is contained in:
Nobuyoshi Nakada 2021-01-20 15:05:30 +09:00
parent f4a556f4f1
commit 565aeb81e0
Notes: git 2021-01-20 19:24:50 +09:00
2 changed files with 8 additions and 1 deletions

View file

@ -730,4 +730,11 @@ class TestClass < Test::Unit::TestCase
end;
end
def test_assign_frozen_class_to_const
c = Class.new.freeze
assert_same(c, Module.new.module_eval("self::Foo = c"))
c = Class.new.freeze
assert_same(c, Module.new.const_set(:Foo, c))
end
end

View file

@ -3058,7 +3058,7 @@ rb_const_set(VALUE klass, ID id, VALUE val)
set_namespace_path(val, build_const_path(parental_path, id));
}
else if (!parental_path_permanent && NIL_P(val_path)) {
rb_ivar_set(val, tmp_classpath, build_const_path(parental_path, id));
ivar_set(val, tmp_classpath, build_const_path(parental_path, id));
}
}
}