summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-19 16:58:53 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-19 16:58:53 +0000
commit4bcae05f01915183e7bc525c0f2e4682a0ec40e0 (patch)
tree60767e3a8b5fb654f49b992b03a2b1c1cacd67ce
parentee2df505d8ee589a7778bf5723e701ec171362d3 (diff)
merge revision(s) r44527: [Backport #9377]
* vm_insnhelper.c (vm_search_super_method): when super called in a bound UnboundMethod generated from a module, no superclass is found since the current defined class is the module, then call method_missing in that case. [ruby-core:59619] [Bug #9377] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--test/ruby/test_super.rb13
-rw-r--r--version.h2
-rw-r--r--vm_insnhelper.c6
4 files changed, 27 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cfd7ee95c5..82445a6b89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Thu Feb 20 01:54:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_search_super_method): when super called in a
+ bound UnboundMethod generated from a module, no superclass is
+ found since the current defined class is the module, then call
+ method_missing in that case. [ruby-core:59619] [Bug #9377]
+
Thu Feb 20 01:33:06 2014 Eric Hodel <drbrain@segment7.net>
* lib/optparse.rb: The Integer acceptable now allows binary and
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index a7a3840d50..87cb3791ca 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -441,4 +441,17 @@ class TestSuper < Test::Unit::TestCase
assert_equal(:ok, o.method(:foo).call, bug9315)
end
end
+
+ def test_missing_super_in_module_unbound_method
+ bug9377 = '[ruby-core:59619] [Bug #9377]'
+
+ a = Module.new do
+ def foo; super end
+ end
+
+ m = a.instance_method(:foo).bind(Object.new.extend(a))
+ assert_raise(NoMethodError, bug9377) do
+ m.call
+ end
+ end
end
diff --git a/version.h b/version.h
index 73b4bcefce..df4802f2c7 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-02-20"
-#define RUBY_PATCHLEVEL 439
+#define RUBY_PATCHLEVEL 440
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 2
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index b7c174d1b3..b3d62bc246 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2031,6 +2031,12 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf
" by define_method() is not supported."
" Specify all arguments explicitly.");
}
+ if (!ci->klass) {
+ /* bound instance method of module */
+ ci->aux.missing_reason = NOEX_SUPER;
+ CI_SET_FASTPATH(ci, vm_call_method_missing, 1);
+ return;
+ }
/* TODO: use inline cache */
ci->me = rb_method_entry(ci->klass, ci->mid, &ci->defined_class);