mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_insnhelper.c (vm_callee_setup_arg_complex, vm_yield_setup_block_args):
clear keyword arguments to prevent GC bug which occurs while marking VM stack. [ruby-dev:47729] [Bug #8964] * test/ruby/test_keyword.rb: tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
202cc8e615
commit
94f5787130
3 changed files with 37 additions and 0 deletions
|
@ -396,4 +396,23 @@ class TestKeywordArguments < Test::Unit::TestCase
|
|||
assert_equal([{}, {}], a.new.foo({}))
|
||||
assert_equal([{}, {:bar=>"x"}], a.new.foo({}, bar: "x"))
|
||||
end
|
||||
|
||||
def test_gced_object_in_stack
|
||||
bug8964 = '[ruby-dev:47729] [Bug #8964]'
|
||||
assert_normal_exit %q{
|
||||
def m(a: [])
|
||||
end
|
||||
GC.stress = true
|
||||
tap { m }
|
||||
GC.start
|
||||
tap { m }
|
||||
}, bug8964
|
||||
assert_normal_exit %q{
|
||||
prc = Proc.new {|a: []|}
|
||||
GC.stress = true
|
||||
tap { prc.call }
|
||||
GC.start
|
||||
tap { prc.call }
|
||||
}, bug8964
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue