Commit 9f82d935 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix `exec s in other_module`

the ast interpreter would incorrectly think it could OSR out to
the JIT, which would barf.
parent 7009ec5d
......@@ -441,9 +441,9 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) {
if (backedge)
threading::allowGLReadPreemption();
if (ENABLE_OSR && backedge && (globals->cls == module_cls)) {
bool can_osr = !FORCE_INTERPRETER && (globals->cls == module_cls);
if (can_osr && edgecount++ == OSR_THRESHOLD_INTERPRETER) {
if (ENABLE_OSR && backedge && edgecount++ == OSR_THRESHOLD_INTERPRETER) {
bool can_osr = !FORCE_INTERPRETER && source_info->scoping->areGlobalsFromModule();
if (can_osr) {
static StatCounter ast_osrs("num_ast_osrs");
ast_osrs.log();
......
......@@ -310,7 +310,8 @@ public:
explicit IREmitterImpl(IRGenState* irstate, llvm::BasicBlock*& curblock, IRGenerator* irgenerator)
: irstate(irstate), builder(new IRBuilder(g.context)), curblock(curblock), irgenerator(irgenerator) {
ASSERT(irstate->getSourceInfo()->scoping->areGlobalsFromModule(), "jit doesn't support custom globals yet");
RELEASE_ASSERT(irstate->getSourceInfo()->scoping->areGlobalsFromModule(),
"jit doesn't support custom globals yet");
builder->setEmitter(this);
builder->SetInsertPoint(curblock);
......
......@@ -29,7 +29,7 @@ python -c 'from PIL import Image; print "Pillow imports"'
""".strip()
# print sh_script
subprocess.check_call(["sh", "-c", sh_script])
subprocess.check_call(["sh", "-c", sh_script], stdout=sys.stderr)
print
print "PASSED"
......@@ -161,3 +161,20 @@ s = "from sys import *"
g = dict()
exec s in g
print "version" in g
# Test to make sure that 'exec s in other_module' is handled correctly:
import import_target
assert import_target.z == 2
z = 3
exec "print z" in import_target.__dict__, {}
exec "print z" in globals(), {}
# Try it with osr as well:
s = """
print z
for i in xrange(20000):
pass
print z
"""
exec s in import_target.__dict__, {}
exec s in globals(), {}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment