From 3af285bebf8d478036a85df97960de3fbf8badd0 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 20 Dec 2001 18:19:42 +0000 Subject: * eval.c (rb_mod_define_method): must not convert Method to Proc. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index f19998ead..c70b24384 100644 --- a/eval.c +++ b/eval.c @@ -6952,11 +6952,8 @@ rb_mod_define_method(argc, argv, mod) else if (argc == 2) { id = rb_to_id(argv[0]); body = argv[1]; - if (rb_obj_is_kind_of(body, rb_cMethod)) { - body = method_proc(body); - } - else if (!rb_obj_is_proc(body)) { - rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc)", + if (!rb_obj_is_kind_of(body, rb_cMethod) && !rb_obj_is_proc(body)) { + rb_raise(rb_eTypeError, "wrong argument type %s (expected Proc/Method)", rb_class2name(CLASS_OF(body))); } } @@ -6971,7 +6968,7 @@ rb_mod_define_method(argc, argv, mod) } else { /* type error */ - rb_raise(rb_eTypeError, "wrong argument type (expected Proc)"); + rb_raise(rb_eTypeError, "wrong argument type (expected Proc/Method)"); } if (SCOPE_TEST(SCOPE_PRIVATE)) { -- cgit