From: nobu.nokada@... Date: 2004-02-29T19:35:00+09:00 Subject: Re: [BUG] Aliasing :lambda Hi, At Sun, 29 Feb 2004 05:54:47 +0900, Florian Gross wrote in [ruby-talk:93919]: > I just found this crash -- it might not make much sense to make :lambda > a module_function and the code was in fact broken, but this should IMHO > be fixed anyway. > > C:\dev\ruby>ruby -e "Module.new { module_function :lambda }" > -e:1: [BUG] undefined method `lambda'; can't happen > ruby 1.8.1 (2004-01-27) [i386-mswin32] Thank you for the report. Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.639 diff -u -2 -p -r1.639 eval.c --- eval.c 27 Feb 2004 13:29:56 -0000 1.639 +++ eval.c 29 Feb 2004 10:18:51 -0000 @@ -6987,6 +6987,6 @@ rb_mod_modfunc(argc, argv, module) } - secure_visibility(module); if (argc == 0) { + secure_visibility(module); SCOPE_SET(SCOPE_MODFUNC); return module; @@ -7000,4 +7000,8 @@ rb_mod_modfunc(argc, argv, module) for (;;) { body = search_method(m, id, &m); + m = RCLASS(m)->super; + if (!body && !m) { + body = search_method(rb_cObject, id, 0); + } if (body == 0 || body->nd_body == 0) { rb_bug("undefined method `%s'; can't happen", rb_id2name(id)); @@ -7006,5 +7010,4 @@ rb_mod_modfunc(argc, argv, module) break; /* normal case: need not to follow 'super' link */ } - m = RCLASS(m)->super; if (!m) break; } -- Nobu Nakada