summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-14 03:39:41 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-14 03:39:41 +0000
commitfd13ad8cdc5991e9fda6d5f9610b32cf160f554c (patch)
tree01234d666cfe5fd7c7ddd8dd16be6bc7987e448a
parentb9d74fd1c1ada57b998e567b72e334bfe31efbc1 (diff)
merge revision(s) 25975:
* eval.c (proc_invoke): unbound block created by define_method cannot call super. [ruby-core:26984] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--eval.c3
-rw-r--r--test/ruby/test_super.rb22
-rw-r--r--version.h2
4 files changed, 28 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ca2dffac8..edeb9132f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Dec 14 12:35:21 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (proc_invoke): unbound block created by define_method
+ cannot call super. [ruby-core:26984]
+
Mon Dec 14 12:06:39 2009 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (rb_digest_instance_method_unimpl): Do not
diff --git a/eval.c b/eval.c
index ab7dbd0b4f..b52aef053b 100644
--- a/eval.c
+++ b/eval.c
@@ -8872,7 +8872,8 @@ proc_invoke(proc, args, self, klass)
_block = *data;
_block.block_obj = bvar;
if (self != Qundef) _block.frame.self = self;
- if (klass) _block.frame.last_class = klass;
+ _block.frame.last_class = klass;
+ if (!klass) _block.frame.last_func = 0;
_block.frame.argc = RARRAY(tmp)->len;
_block.frame.flags = ruby_frame->flags;
if (_block.frame.argc && DMETHOD_P()) {
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb
index 900fe997e6..a9d931c0ef 100644
--- a/test/ruby/test_super.rb
+++ b/test/ruby/test_super.rb
@@ -126,9 +126,27 @@ class TestSuper < Test::Unit::TestCase
end
end
- def test_define_method # [ruby-core:03856]
+ class B
+ def m
+ [self, "#{self.class.to_s}::m"]
+ end
+ end
+
+ class C < B
+ def self.t
+ define_method(:m) {super}
+ end
+ end
+
+ def test_define_method
a = A.new
a.uu(12)
- assert_equal("A#tt", a.tt(12))
+ assert_equal("A#tt", a.tt(12), '[ruby-core:03856]')
+
+ bug2419 = '[ruby-core:26984]'
+ q = C.t
+ assert_raise(NoMethodError, bug2419) {q.call}
+ c = C.new
+ assert_equal([c, "#{C.to_s}::m"], c.m, bug2419)
end
end
diff --git a/version.h b/version.h
index 025f4876f6..cf3fe7accd 100644
--- a/version.h
+++ b/version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2009-12-14"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20091214
-#define RUBY_PATCHLEVEL 234
+#define RUBY_PATCHLEVEL 235
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8