Skip to content

Commit

Permalink
Skip freezing check on setting temporary class path [Bug #17563]
Browse files Browse the repository at this point in the history
Co-authored-by: ryannevell (Ryan Nevell) <ryan.nevell@gmail.com>
  • Loading branch information
nobu and ryannevell committed Jan 20, 2021
1 parent f4a556f commit 565aeb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions test/ruby/test_class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -730,4 +730,11 @@ def (Array.singleton_class).bla; :bla; end
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
2 changes: 1 addition & 1 deletion variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}
Expand Down

0 comments on commit 565aeb8

Please sign in to comment.