[BUG] Aliasing :lambda

F

Florian Gross

Moin!

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]

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.

---

<batsman> Module.new { module_function :lambda }
<batsman> -:1: [BUG] undefined method `lambda'; can't happen
<batsman> ruby 1.8.0 (2003-08-04) [i686-linux]

---

I send this to both comp.lang.ruby and matz, because the gateway seems
to be quite instable at the moment. I hope this message doesn't get lost
in total nirvana.

Regards,
Florian Gross
 
N

nobu.nokada

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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top