Commit a83d22dd authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge remote-tracking branch 'origin/refcounting' into refcounting

parents b0c7a9a5 6d67cffd
...@@ -1099,6 +1099,7 @@ Value ASTInterpreter::createFunction(AST* node, AST_arguments* args, const std:: ...@@ -1099,6 +1099,7 @@ Value ASTInterpreter::createFunction(AST* node, AST_arguments* args, const std::
defaults_var->setAttr(i++ * sizeof(void*), v); defaults_var->setAttr(i++ * sizeof(void*), v);
} }
defaults.push_back(0); defaults.push_back(0);
AUTO_XDECREF_ARRAY(defaults.data(), defaults.size());
// FIXME: Using initializer_list is pretty annoying since you're not supposed to create them: // FIXME: Using initializer_list is pretty annoying since you're not supposed to create them:
union { union {
...@@ -1200,7 +1201,7 @@ Value ASTInterpreter::visit_makeClass(AST_MakeClass* mkclass) { ...@@ -1200,7 +1201,7 @@ Value ASTInterpreter::visit_makeClass(AST_MakeClass* mkclass) {
basesTuple->elts[base_idx++] = visit_expr(b).o; basesTuple->elts[base_idx++] = visit_expr(b).o;
} }
std::vector<DecrefHandle<Box>> decorators; std::vector<Box*> decorators;
for (AST_expr* d : node->decorator_list) for (AST_expr* d : node->decorator_list)
decorators.push_back(visit_expr(d).o); decorators.push_back(visit_expr(d).o);
...@@ -1224,8 +1225,7 @@ Value ASTInterpreter::visit_makeClass(AST_MakeClass* mkclass) { ...@@ -1224,8 +1225,7 @@ Value ASTInterpreter::visit_makeClass(AST_MakeClass* mkclass) {
Box* classobj = createUserClass(node->name.getBox(), basesTuple, attrDict); Box* classobj = createUserClass(node->name.getBox(), basesTuple, attrDict);
for (int i = decorators.size() - 1; i >= 0; i--) { for (int i = decorators.size() - 1; i >= 0; i--) {
AUTO_DECREF(classobj); classobj = runtimeCall(autoDecref(decorators[i]), ArgPassSpec(1), autoDecref(classobj), 0, 0, 0, 0);
classobj = runtimeCall(decorators[i], ArgPassSpec(1), classobj, 0, 0, 0, 0);
} }
return Value(classobj, NULL); return Value(classobj, NULL);
...@@ -1263,11 +1263,15 @@ Value ASTInterpreter::visit_assert(AST_Assert* node) { ...@@ -1263,11 +1263,15 @@ Value ASTInterpreter::visit_assert(AST_Assert* node) {
// Currently we only generate "assert 0" statements // Currently we only generate "assert 0" statements
Value v = visit_expr(node->test); Value v = visit_expr(node->test);
assert(v.o->cls == int_cls && static_cast<BoxedInt*>(v.o)->n == 0); assert(v.o->cls == int_cls && static_cast<BoxedInt*>(v.o)->n == 0);
Py_DECREF(v.o);
#endif #endif
static BoxedString* AssertionError_str = getStaticString("AssertionError"); static BoxedString* AssertionError_str = getStaticString("AssertionError");
Box* assertion_type = getGlobal(frame_info.globals, AssertionError_str); Box* assertion_type = getGlobal(frame_info.globals, AssertionError_str);
assertFail(assertion_type, node->msg ? visit_expr(node->msg).o : 0); AUTO_DECREF(assertion_type);
Box* msg = node->msg ? visit_expr(node->msg).o : 0;
AUTO_XDECREF(msg);
assertFail(assertion_type, msg);
return Value(); return Value();
} }
......
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