diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 19:40:13 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-06-18 19:40:13 +0000 |
commit | f56c0c063174caa417ca1e54d59d76c266026bbf (patch) | |
tree | 6016d17aec0830656f1fd1259e0d97037abce714 | |
parent | 12f4488c582a4f80bfe971754dbf7da7df2cea95 (diff) |
merge revision(s) 41389: [Backport #8540]
* vm_insnhelper.c (vm_call_method): ensure methods of type
VM_METHOD_TYPE_ATTR_SET are called with 1 argument
* test/ruby/test_module.rb (class TestModule): add test
[ruby-core:55543] [Bug #8540]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 8 | ||||
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | vm_insnhelper.c | 2 |
4 files changed, 19 insertions, 2 deletions
@@ -1,3 +1,12 @@ +Wed Jun 19 04:20:31 2013 Charlie Somerville <charliesome@ruby-lang.org> + + * vm_insnhelper.c (vm_call_method): ensure methods of type + VM_METHOD_TYPE_ATTR_SET are called with 1 argument + + * test/ruby/test_module.rb (class TestModule): add test + + [ruby-core:55543] [Bug #8540] + Wed Jun 19 03:54:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org> * defs/id.def (predefined): add "idProc". diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index 9db30ee39c..1239711756 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -1165,6 +1165,14 @@ class TestModule < Test::Unit::TestCase assert_equal(1, c.x, bug3406) end + def test_attr_writer_with_no_arguments + bug8540 = "[ruby-core:55543]" + c = Class.new do + attr_writer :foo + end + assert_raise(ArgumentError) { c.new.send :foo= } + end + def test_private_constant c = Class.new c.const_set(:FOO, "foo") @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-06-19" -#define RUBY_PATCHLEVEL 232 +#define RUBY_PATCHLEVEL 233 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 6 diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 0cc053dad0..0a40a1e0dc 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1750,7 +1750,7 @@ vm_call_method(rb_thread_t *th, rb_control_frame_t *cfp, rb_call_info_t *ci) CI_SET_FASTPATH(ci, vm_call_cfunc, enable_fastpath); return vm_call_cfunc(th, cfp, ci); case VM_METHOD_TYPE_ATTRSET:{ - rb_check_arity(ci->argc, 0, 1); + rb_check_arity(ci->argc, 1, 1); ci->aux.index = 0; CI_SET_FASTPATH(ci, vm_call_attrset, enable_fastpath && !(ci->flag & VM_CALL_ARGS_SPLAT)); return vm_call_attrset(th, cfp, ci); |