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