From: nobu.nakada@... Date: 2001-12-21T02:17:44+09:00 Subject: [ruby-dev:15509] [PATCH] SEGV on calling Module#define_method(Method) なかだです。 $ ruby -e 'class String;define_method(:<=>,instance_method(:<=>));end;""<=>""' -e:1: [BUG] Segmentation fault ruby 1.7.2 (2001-12-19) [i686-linux] アボートしました (core dumped) ここでMethodをProcに変換してしまってはまずいのでは。 Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.236 diff -u -2 -p -r1.236 eval.c --- eval.c 2001/12/19 07:48:30 1.236 +++ eval.c 2001/12/20 17:14:03 @@ -6953,9 +6953,6 @@ rb_mod_define_method(argc, argv, mod) 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))); } @@ -6972,5 +6969,5 @@ 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)"); } -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦