1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (rb_mod_define_method): must not convert Method to Proc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2001-12-20 18:19:42 +00:00
parent b7a58b0650
commit c29a112e14
2 changed files with 7 additions and 6 deletions

View file

@ -1,3 +1,7 @@
Fri Dec 21 03:15:52 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* eval.c (rb_mod_define_method): must not convert Method to Proc.
Fri Dec 21 01:17:57 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* lib/mkmf.rb (with_destdir): new.

9
eval.c
View file

@ -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)) {