diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-04 23:08:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-04 23:08:32 +0000 |
commit | 918fefb7f71487770b538336fca0dca8d442d32e (patch) | |
tree | 19f6fec4fd8e2a420fbf9a06e6d899bdb37a3382 | |
parent | a82c5ee48b805333f68b613b8eb76cd05e5a0078 (diff) | |
download | ruby-918fefb7f71487770b538336fca0dca8d442d32e.tar.gz |
* vm_insnhelper.c (vm_yield_setup_block_args): restores the first
arg where is overwritten at funcall. [ruby-core:24139]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_proc.rb | 7 | ||||
-rw-r--r-- | version.h | 4 | ||||
-rw-r--r-- | vm_insnhelper.c | 8 |
4 files changed, 20 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Sun Jul 5 08:08:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * vm_insnhelper.c (vm_yield_setup_block_args): restores the firs + arg where is overwritten at funcall. [ruby-core:24139] + Sat Jul 4 08:20:03 2009 Yukihiro Matsumoto <matz@ruby-lang.org> * numeric.c (dbl2ival): should raise FloatDomainError on Infinity diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 8439f8cd6b..e557f185f2 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -747,4 +747,11 @@ class TestProc < Test::Unit::TestCase assert_match(/^#{ Regexp.quote(__FILE__) }$/, file) assert_equal(source_location_test - 1, lineno) end + + def test_splat_without_respond_to + def (obj = Object.new).respond_to?(m); false end + [obj].each do |a, b| + assert_equal([obj, nil], [a, b], '[ruby-core:24139]') + end + end end @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_RELEASE_DATE "2009-07-04" +#define RUBY_RELEASE_DATE "2009-07-05" #define RUBY_PATCHLEVEL -1 #define RUBY_BRANCH_NAME "trunk" @@ -8,7 +8,7 @@ #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 7 -#define RUBY_RELEASE_DAY 4 +#define RUBY_RELEASE_DAY 5 #include "ruby/version.h" diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 8412e4a77b..443b16b4ff 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -761,7 +761,7 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq, int i; int argc = orig_argc; const int m = iseq->argc; - VALUE ary; + VALUE ary, arg0; rb_num_t opt_pc = 0; th->mark_stack_len = argc; @@ -771,15 +771,19 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq, * => {|a|} => a = [1, 2] * => {|a, b|} => a, b = [1, 2] */ + arg0 = argv[0]; if (!(iseq->arg_simple & 0x02) && /* exclude {|a|} */ (m + iseq->arg_post_len) > 0 && /* this process is meaningful */ - argc == 1 && !NIL_P(ary = rb_check_array_type(argv[0]))) { /* rhs is only an array */ + argc == 1 && !NIL_P(ary = rb_check_array_type(arg0))) { /* rhs is only an array */ th->mark_stack_len = argc = RARRAY_LENINT(ary); CHECK_STACK_OVERFLOW(th->cfp, argc); MEMCPY(argv, RARRAY_PTR(ary), VALUE, argc); } + else { + argv[0] = arg0; + } for (i=argc; i<m; i++) { argv[i] = Qnil; |