[前][次][番号順一覧][スレッド一覧]

ruby-changes:14170

From: shugo <ko1@a...>
Date: Fri, 4 Dec 2009 16:09:28 +0900 (JST)
Subject: [ruby-changes:14170] Ruby:r25988 (trunk): avoid SEGV in instance_eval without block.

shugo	2009-12-04 16:09:17 +0900 (Fri, 04 Dec 2009)

  New Revision: 25988

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25988

  Log:
    avoid SEGV in instance_eval without block.
    instance_eval does not yield self.

  Modified files:
    trunk/vm_eval.c

Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 25987)
+++ vm_eval.c	(revision 25988)
@@ -1168,11 +1168,16 @@
 	block.self = self;
 	th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
     }
-    cref = vm_cref_push(th, under, NOEX_PUBLIC, &block);
+    cref = vm_cref_push(th, under, NOEX_PUBLIC, blockptr);
     cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
 
     if (values == Qundef) {
+#if 0
+	/* The behavior of Ruby 1.8  */
 	return vm_yield_with_cref(th, 1, &self, cref);
+#else
+	return vm_yield_with_cref(th, 0, 0, cref);
+#endif
     }
     else {
 	return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_PTR(values), cref);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]