Commit 84797a2e authored by Kevin Modzelewski's avatar Kevin Modzelewski

Some exec fixes

parent 15be392b
......@@ -516,7 +516,7 @@ static void pickGlobalsAndLocals(Box*& globals, Box*& locals) {
PyDict_SetItemString(globals_dict, "__builtins__", builtins_module);
else
RELEASE_ASSERT(requested_builtins == builtins_module
|| requested_builtins == autoDecref(builtins_module->getAttrWrapper()),
|| requested_builtins == builtins_module->getAttrWrapper(),
"we don't support overriding __builtins__");
}
}
......
......@@ -235,6 +235,7 @@ void IRGenState::setupFrameInfoVar(llvm::Value* passed_closure, llvm::Value* pas
if (getScopeInfo()->usesNameLookup()) {
// load frame_info.boxedLocals
this->boxed_locals = builder.CreateLoad(getBoxedLocalsGep(builder, this->frame_info));
getRefcounts()->setType(this->boxed_locals, RefType::BORROWED);
}
} else {
......@@ -1914,10 +1915,11 @@ private:
module->setattr(emitter, getEmptyOpInfo(unw_info), name.getBox(), val);
} else {
auto converted = val->makeConverted(emitter, val->getBoxType());
emitter.createCall3(
auto cs = emitter.createCall3(
unw_info, g.funcs.setGlobal, irstate->getGlobals(),
emitter.setType(embedRelocatablePtr(name.getBox(), g.llvm_boxedstring_type_ptr), RefType::BORROWED),
converted->getValue());
emitter.refConsumed(converted->getValue(), cs);
}
} else if (vst == ScopeInfo::VarScopeType::NAME) {
// TODO inefficient
......
......@@ -7245,7 +7245,6 @@ extern "C" Box* getGlobal(Box* globals, BoxedString* name) {
extern "C" void setGlobal(Box* globals, BoxedString* name, STOLEN(Box*) value) {
if (globals->cls == attrwrapper_cls) {
assert(0 && "check refcounting");
globals = unwrapAttrWrapper(globals);
RELEASE_ASSERT(globals->cls == module_cls, "%s", globals->cls->tp_name);
}
......@@ -7262,6 +7261,7 @@ extern "C" void setGlobal(Box* globals, BoxedString* name, STOLEN(Box*) value) {
} else {
RELEASE_ASSERT(globals->cls == dict_cls, "%s", globals->cls->tp_name);
int r = PyDict_SetItem(globals, name, value);
Py_DECREF(value);
if (r == -1)
throwCAPIException();
}
......
# expected: reffail
print 'Test getting'
g = {'a': 1}
......
# expected: reffail
try:
import __pyston__
__pyston__.setOption("OSR_THRESHOLD_BASELINE", 50)
......
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