[#28653] create header (Re: Re: ossl_cipher.c:124: warning: control reaches end of non-void function) — "Nobuyoshi Nakada" <nobu@...>

なかだです。

8 messages 2006/05/18

[ruby-dev:28658] Re: [BUG] constant in Fixnum access with instance_eval dumps core

From: nobu@...
Date: 2006-05-20 15:52:24 UTC
List: ruby-dev #28658
なかだです。

At Sat, 20 May 2006 23:44:38 +0900,
sheepman wrote in [ruby-dev:28657]:
> Ruby のバグ(勝手に)トラッカーでは [ruby-dev:28327] は fixed に
> なっていますが、まだ直っていないようです。

ここしばらくの変更をちゃんと追ってないんですが、こんなとこでしょ
うか。


Index: eval.c
===================================================================
RCS file: /cvs/ruby/src/ruby/eval.c,v
retrieving revision 1.890
diff -p -U2 -r1.890 eval.c
--- eval.c	23 Feb 2006 04:24:39 -0000	1.890
+++ eval.c	20 May 2006 15:44:13 -0000
@@ -1777,5 +1777,7 @@ static VALUE
 ev_const_defined(ID id, VALUE self)
 {
-    return rb_const_defined_fallback(ruby_cbase, id, ruby_cref->nd_next);
+    VALUE cbase = ruby_cbase;
+    if (NIL_P(cbase)) cbase = 0;
+    return rb_const_defined_fallback(cbase, id, ruby_cref->nd_next);
 }
 
@@ -1783,5 +1785,7 @@ static VALUE
 ev_const_get(ID id, VALUE self)
 {
-    return rb_const_get_fallback(ruby_cbase, id, ruby_cref->nd_next);
+    VALUE cbase = ruby_cbase;
+    if (NIL_P(cbase)) cbase = 0;
+    return rb_const_get_fallback(cbase, id, ruby_cref->nd_next);
 }
 
@@ -6366,5 +6370,5 @@ rb_f_eval(int argc, VALUE *argv, VALUE s
 /* function to call func under the specified class/module context */
 static VALUE
-exec_under(VALUE (*func) (VALUE), VALUE under, VALUE args)
+exec_under(VALUE (*func) (VALUE), VALUE under, VALUE self, VALUE args)
 {
     VALUE val = Qnil;		/* OK */
@@ -6373,4 +6377,5 @@ exec_under(VALUE (*func) (VALUE), VALUE 
     struct FRAME *f = ruby_frame;
 
+    if (NIL_P(under)) PUSH_CREF(rb_obj_class(self));
     PUSH_CREF(under);
     PUSH_FRAME(Qtrue);
@@ -6389,4 +6394,5 @@ exec_under(VALUE (*func) (VALUE), VALUE 
     POP_TAG();
     POP_CREF();
+    if (NIL_P(under)) POP_CREF();
     VIS_SET(mode);
     POP_FRAME();
@@ -6424,5 +6430,5 @@ eval_under(VALUE under, VALUE self, VALU
     args[2] = (VALUE)file;
     args[3] = (VALUE)line;
-    return exec_under(eval_under_i, under, (VALUE)args);
+    return exec_under(eval_under_i, under, self, (VALUE)args);
 }
 
@@ -6446,5 +6452,5 @@ yield_under(VALUE under, VALUE self, VAL
     args[0] = values;
     args[1] = self;
-    return exec_under(yield_under_i, under, (VALUE)args);
+    return exec_under(yield_under_i, under, self, (VALUE)args);
 }
 
@@ -6517,5 +6523,5 @@ rb_obj_instance_eval(int argc, VALUE *ar
     VALUE klass;
 
-    if (SPECIAL_CONST_P(self)) {
+    if (IMMEDIATE_P(self) && self != Qtrue) {
 	klass = Qnil;
     }


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread

Prev Next