summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index f6424372f7..3e9512e5f8 100644
--- a/eval.c
+++ b/eval.c
@@ -545,7 +545,9 @@ int
rb_block_given_p(void)
{
rb_thread_t *th = GET_THREAD();
- if (GC_GUARDED_PTR_REF(th->cfp->lfp[0])) {
+
+ if ((th->cfp->lfp[0] & 0x02) == 0 &&
+ GC_GUARDED_PTR_REF(th->cfp->lfp[0])) {
return Qtrue;
}
else {
@@ -588,7 +590,9 @@ rb_f_block_given_p(void)
rb_control_frame_t *cfp = th->cfp;
cfp = vm_get_ruby_level_caller_cfp(th, RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp));
- if (cfp != 0 && GC_GUARDED_PTR_REF(cfp->lfp[0])) {
+ if (cfp != 0 &&
+ (cfp->lfp[0] & 0x02) == 0 &&
+ GC_GUARDED_PTR_REF(cfp->lfp[0])) {
return Qtrue;
}
else {