summaryrefslogtreecommitdiffstats
path: root/vm_eval.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-04 07:09:17 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-04 07:09:17 +0000
commitca68de3031f139c28df0763bd040a2bab8c659e7 (patch)
treee6d7e43b7d9c75c5bb0c3642419c5a6578e3ce14 /vm_eval.c
parentd928d3e719ab35f95a1761ecddd594abbb73a3df (diff)
downloadruby-ca68de3031f139c28df0763bd040a2bab8c659e7.tar.gz
ruby-ca68de3031f139c28df0763bd040a2bab8c659e7.tar.xz
ruby-ca68de3031f139c28df0763bd040a2bab8c659e7.zip
avoid SEGV in instance_eval without block.
instance_eval does not yield self. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 60c45e080..af0a4884d 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -1168,11 +1168,16 @@ yield_under(VALUE under, VALUE self, VALUE values)
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);