From 94270ee0e58336535378eef7fbb889c127f25c6b Mon Sep 17 00:00:00 2001 From: Marcelo Lira Date: Fri, 17 Dec 2010 11:05:53 -0300 Subject: Removed unnecessary code to check the refcount of Python objects returned on virtual methods. Reviewed by Hugo Parente Reviewed by Luciano Wolf --- generator/cppgenerator.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'generator/cppgenerator.cpp') diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index f1e900f36..ea304b937 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -810,20 +810,8 @@ void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFu writeCodeSnips(s, snips, CodeSnip::End, TypeSystem::NativeCode, func, lastArg); } - if (type) { - if (!invalidateReturn && (func->type()->isObject() || func->type()->isValuePointer()) ) { - s << INDENT << "if (" << PYTHON_RETURN_VAR << "->ob_refcnt < 2) {" << endl; - { - Indentation indent(INDENT); - s << INDENT << "PyErr_SetString(PyExc_ReferenceError, \"Returning last python reference on virtual function: " - << func->ownerClass()->name() << "." << func->name() << "\");" << endl; - s << INDENT << "PyErr_Print();" << endl; - s << INDENT << "assert(false);" << endl; - } - s << INDENT << "}" << endl; - } + if (type) s << INDENT << "return " CPP_RETURN_VAR ";" << endl; - } s << '}' << endl << endl; } -- cgit v1.2.3