From: Paul Brannan Date: 2008-10-22T04:17:10+09:00 Subject: [ruby-core:19425] Re: rb_errinfo() vs rb_rubylevel_errinfo() On Wed, Oct 22, 2008 at 02:46:56AM +0900, SASADA Koichi wrote: > How about such an example? > > def m > raise Thread.current[:err] = 'bar' > rescue > end > begin > > raise Thread.current[:err] = 'foo' > rescue > m > p $! #=> # > p Thread.current[:err] #=> "bar" > end > > BTW, 1.8 also solved such problem. This shows that 1.8 doesn't use > thread local variable (TLV) for errinfo (yes, it use TLV, but not > only TLV). Yes, 1.8 saves ruby_errinfo on the stack when it evaluates NODE_RESCUE, then (if not raising a new exception) sets it back when it is done. YARV looks like it does the same with th->errinfo. However, on 1.8 ruby_errinfo and $! are always the same, while on YARV rb_errinfo() may not always be the same as $!. I found this surprising. > > Also, I had been curious whether rb_rubylevel_errinfo() should be > > declared in ruby.h. > > really? on the trunk? It is an export symbol that isn't used anywhere inside ruby, so it seems to be available for users, but I don't see it declared in any of the public headers. Paul