merge revision(s) 55609: [Backport #12568]

* vm_args.c (setup_parameters_complex): don't raise ArgumentError
	  if an array is given for instance_exec with optional argument.
	  [ruby-core:76300] [Bug #12568]
	  https://github.com/rails/rails/pull/25699


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55956 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2016-08-18 14:03:36 +00:00
parent 7f7360a885
commit 2c07970dd7
4 changed files with 18 additions and 3 deletions

View file

@ -1,3 +1,10 @@
Thu Aug 18 22:52:19 2016 NARUSE, Yui <naruse@ruby-lang.org>
* vm_args.c (setup_parameters_complex): don't raise ArgumentError
if an array is given for instance_exec with optional argument.
[ruby-core:76300] [Bug #12568]
https://github.com/rails/rails/pull/25699
Tue Aug 16 12:27:48 2016 Koichi Sasada <ko1@atdot.net> Tue Aug 16 12:27:48 2016 Koichi Sasada <ko1@atdot.net>
* gc.c (gc_mark_roots): should mark the VM object itself to mark * gc.c (gc_mark_roots): should mark the VM object itself to mark

View file

@ -72,6 +72,13 @@ class TestLambdaParameters < Test::Unit::TestCase
assert_raise(ArgumentError, bug9605) {proc(&plus).call [1,2]} assert_raise(ArgumentError, bug9605) {proc(&plus).call [1,2]}
end end
def test_instance_exec
bug12568 = '[ruby-core:76300] [Bug #12568]'
assert_nothing_raised(ArgumentError, bug12568) do
instance_exec([1,2,3], &->(a=[]){ a })
end
end
def yield_1(arg) def yield_1(arg)
yield arg yield arg
end end

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.3.2" #define RUBY_VERSION "2.3.2"
#define RUBY_RELEASE_DATE "2016-08-16" #define RUBY_RELEASE_DATE "2016-08-18"
#define RUBY_PATCHLEVEL 167 #define RUBY_PATCHLEVEL 168
#define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_YEAR 2016
#define RUBY_RELEASE_MONTH 8 #define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 16 #define RUBY_RELEASE_DAY 18
#include "ruby/version.h" #include "ruby/version.h"

View file

@ -587,6 +587,7 @@ setup_parameters_complex(rb_thread_t * const th, const rb_iseq_t * const iseq,
case arg_setup_lambda: case arg_setup_lambda:
if (given_argc == 1 && if (given_argc == 1 &&
given_argc != iseq->body->param.lead_num && given_argc != iseq->body->param.lead_num &&
!iseq->body->param.flags.has_opt &&
!iseq->body->param.flags.has_rest && !iseq->body->param.flags.has_rest &&
args_check_block_arg0(args, th)) { args_check_block_arg0(args, th)) {
given_argc = RARRAY_LENINT(args->rest); given_argc = RARRAY_LENINT(args->rest);