From ef039de5604582fbf87aea2dbc9a28697423aa51 Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 24 Aug 2011 23:37:56 +0000 Subject: * vm.c (vm_make_env_each): work around to solve Bug #2729. fixes: Bug #2729 a patch from Kazuki Tsujimoto This problem is caused by changing dfp (dynamic env pointer) from saved dfp. Saved dfp is pointed env in VM stack. However, the dfp can be moved because VM copies env from VM stack to the heap. At this copying, dfp was also changed. To solve this problem, I'll try to change throw mechanism (not save target dfp, but save target cfp). * bootstraptest/test_flow.rb: add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bootstraptest/test_flow.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_flow.rb b/bootstraptest/test_flow.rb index 02062755aa..100ad0a2f1 100644 --- a/bootstraptest/test_flow.rb +++ b/bootstraptest/test_flow.rb @@ -517,6 +517,19 @@ assert_equal %Q{ENSURE\n}, %q{ end end e = Bug2728.new +}], + ['[ruby-core:28132]', %q{ + class Bug2729 + include Enumerable + def each + begin + yield :foo + ensure + proc {}.call + end + end + end + e = Bug2729.new }]].each do |bug, src| assert_equal "foo", src + %q{e.detect {true}}, bug assert_equal "true", src + %q{e.any? {true}}, bug -- cgit v1.2.3