Skip to content

Commit

Permalink
Merge pull request #5170 from jruby/clone_more_block_for_exec
Browse files Browse the repository at this point in the history
Clone frame and block before proceeding into class_exec logic.
  • Loading branch information
headius committed May 14, 2018
2 parents d48b638 + bd0f3f8 commit f26c752
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/RubyModule.java
Expand Up @@ -3059,7 +3059,7 @@ public IRubyObject module_eval(ThreadContext context, IRubyObject[] args, Block
writes = {LASTLINE, BACKREF, VISIBILITY, BLOCK, SELF, METHODNAME, LINE, CLASS, FILENAME, SCOPE})
public IRubyObject module_exec(ThreadContext context, Block block) {
if (block.isGiven()) {
return yieldUnder(context, this, IRubyObject.NULL_ARRAY, block, EvalType.MODULE_EVAL);
return yieldUnder(context, this, IRubyObject.NULL_ARRAY, block.cloneBlockAndFrame(), EvalType.MODULE_EVAL);
} else {
throw context.runtime.newLocalJumpErrorNoBlock();
}
Expand All @@ -3070,7 +3070,7 @@ public IRubyObject module_exec(ThreadContext context, Block block) {
writes = {LASTLINE, BACKREF, VISIBILITY, BLOCK, SELF, METHODNAME, LINE, CLASS, FILENAME, SCOPE})
public IRubyObject module_exec(ThreadContext context, IRubyObject[] args, Block block) {
if (block.isGiven()) {
return yieldUnder(context, this, args, block, EvalType.MODULE_EVAL);
return yieldUnder(context, this, args, block.cloneBlockAndFrame(), EvalType.MODULE_EVAL);
} else {
throw context.runtime.newLocalJumpErrorNoBlock();
}
Expand Down

0 comments on commit f26c752

Please sign in to comment.