diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | test/ruby/test_lambda.rb | 7 | ||||
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | vm_args.c | 1 |
4 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,10 @@ +Fri Aug 12 11:48:27 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 + Fri Aug 12 11:45:02 2016 Shugo Maeda <shugo@ruby-lang.org> * lib/net/http/generic_rquest.rb (write_header): A Request-Line must diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb index 0f3382ce78..b12fcf8834 100644 --- a/test/ruby/test_lambda.rb +++ b/test/ruby/test_lambda.rb @@ -71,6 +71,13 @@ class TestLambdaParameters < Test::Unit::TestCase assert_raise(ArgumentError, bug9605) {proc(&plus).call [1,2]} 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) yield arg end @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-08-12" -#define RUBY_PATCHLEVEL 347 +#define RUBY_PATCHLEVEL 348 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 8 @@ -578,6 +578,7 @@ setup_parameters_complex(rb_thread_t * const th, const rb_iseq_t * const iseq, r case arg_setup_lambda: if (given_argc == 1 && given_argc != iseq->param.lead_num && + !iseq->param.flags.has_opt && !iseq->param.flags.has_rest && args_check_block_arg0(args, th)) { given_argc = RARRAY_LENINT(args->rest); |