Bug #1150: calling instance_eval in extended library cause exception
http://redmine.ruby-lang.org/issues/show/1150
e$B5/I<<Te(B: Akio T.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
Target version: 1.9.1
ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
e$B3HD%%i%$%V%i%jFb$N%a%=%C%I$Ge(Binstance_evale$B$r8F$S=P$9$H!"e(BCan’t
eval on top of Fiber or Thread (RuntimeError)e$B$K$J$j$^$9!#e(B
e$B:F8=%3!<%I$r0J2<$K<($7$^$9!#e(B
// cmodev.c
#include “ruby.h”
#include “extconf.h”
static VALUE cmodev;
static VALUE xtest_func(VALUE self, VALUE s)
{
return rb_funcall2(self, rb_intern(“instance_eval”), 1, &s);
}
void Init_cmodev()
{
cmodev = rb_define_class(“XTest”, rb_cObject);
rb_define_method(cmodev, “xtest”, xtest_func, 1);
}
#t.rb
require ‘cmodev’
x = XTest.new
x.xtest(“puts ‘hello’”)
e$B<B9TNce(B
c:\test\modev\test>ruby t.rb
t.rb:3:in instance_eval': Can't eval on top of Fiber or Thread (RuntimeError) from t.rb:3:in
xtest’
from t.rb:3:in `’