From: matz@... (Yukihiro Matsumoto) Date: 2002-03-04T00:17:53+09:00 Subject: Re: class vars broken in 1.6.7 Hi, In message "class vars broken in 1.6.7" on 02/03/03, Joel VanderWerf writes: |This code printed "5" in 1.6.6, but in 1.6.7 it gives "uninitialized |class variable": Oops, this is a serious bug. You will see 1.6.8 soon. Here's the patch for you: diff -u -1 -r1.137.2.104 eval.c --- eval.c 2002/02/27 04:50:29 1.137.2.104 +++ eval.c 2002/03/03 15:14:04 @@ -2734,3 +2734,7 @@ result = rb_eval(self, node->nd_value); - rb_cvar_set(ruby_cbase, node->nd_vid, result); + if (!FL_TEST(ruby_cbase, FL_SINGLETON)) { + rb_cvar_set(ruby_cbase, node->nd_vid, result); + break; + } + rb_cvar_set(rb_iv_get(ruby_cbase, "__attached__"), node->nd_vid, result); break; @@ -3828,3 +3832,7 @@ case NODE_CVASGN: - rb_cvar_set(ruby_cbase, lhs->nd_vid, val); + if (!FL_TEST(ruby_cbase, FL_SINGLETON)) { + rb_cvar_set(ruby_cbase, lhs->nd_vid, val); + break; + } + rb_cvar_set(rb_iv_get(ruby_cbase, "__attached__"), lhs->nd_vid, val); break;