Hi, At Mon, 24 Jul 2006 15:19:40 +0900, Yukihiro Matsumoto wrote in [ruby-core:08375]: > > Hi, > > In message "Re: Patch to Ruby in 2005" > on Thu, 20 Jul 2006 01:11:09 +0900, "John Fletcher" <J.P.Fletcher / aston.ac.uk> writes: > > |We are having some trouble as a result, because when using the > |coerce feature of ruby, the call stack no longer contains the > |information needed, and we have traced this to a line of code in > |backtrace in eval.c. > | > | if (frame->prev->node == n) continue; > | > |If this is commented out then the problem goes away. > > Can you show us the error reproducing code example? $ ruby-1.8.4 -e 'class X; def coerce(y) p caller(0); [1, y]; end; end' -e 'p 1+X.new' ["-e:1:in `coerce'", "-e:2:in `+'", "-e:2"] 2 $ ./ruby -e 'class X; def coerce(y) p caller(0); [1, y]; end; end' -e 'p 1+X.new' ["-e:1:in `coerce'", "-e:2"] 2 Second string is missing.
Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.616.2.184 diff -p -U 2 -r1.616.2.184 eval.c --- eval.c 24 Jul 2006 06:25:21 -0000 1.616.2.184 +++ eval.c 24 Jul 2006 07:48:10 -0000 @@ -5849,5 +5849,4 @@ rb_call0(klass, recv, id, oid, argc, arg PUSH_SCOPE(); - ruby_current_node = body; if (body->nd_rval) { saved_cref = ruby_cref; @@ -6255,5 +6254,7 @@ backtrace(lev) for (; frame && (n = frame->node); frame = frame->prev) { if (frame->prev && frame->prev->last_func) { - if (frame->prev->node == n) continue; + if (frame->prev->node == n) { + if (frame->prev->last_func == frame->last_func) continue; + } snprintf(buf, BUFSIZ, "%s:%d:in `%s'", n->nd_file, nd_line(n),
-- Nobu Nakada