зеркало из https://github.com/github/ruby.git
rb_obj_setup: do not copy RUBY_FL_SEEN_OBJ_ID
[Bug #20250] We're seting up a new instance, so it never had an associated object_id.
This commit is contained in:
Родитель
cf1cd215c0
Коммит
d19d683a35
2
object.c
2
object.c
|
@ -120,7 +120,7 @@ rb_obj_reveal(VALUE obj, VALUE klass)
|
|||
VALUE
|
||||
rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
|
||||
{
|
||||
VALUE ignored_flags = RUBY_FL_PROMOTED;
|
||||
VALUE ignored_flags = RUBY_FL_PROMOTED | RUBY_FL_SEEN_OBJ_ID;
|
||||
RBASIC(obj)->flags = (type & ~ignored_flags) | (RBASIC(obj)->flags & ignored_flags);
|
||||
RBASIC_SET_CLASS(obj, klass);
|
||||
return obj;
|
||||
|
|
|
@ -73,6 +73,13 @@ class TestClone < Test::Unit::TestCase
|
|||
assert_equal(cloned_obj.instance_variable_get(:@a), 1)
|
||||
end
|
||||
|
||||
def test_proc_obj_id_flag_reset
|
||||
# [Bug #20250]
|
||||
proc = Proc.new { }
|
||||
proc.object_id
|
||||
proc.clone.object_id # Would crash with RUBY_DEBUG=1
|
||||
end
|
||||
|
||||
def test_user_flags
|
||||
assert_separately([], <<-EOS)
|
||||
#
|
||||
|
|
Загрузка…
Ссылка в новой задаче