aboutsummaryrefslogtreecommitdiffstats
path: root/generator/cppgenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'generator/cppgenerator.cpp')
-rw-r--r--generator/cppgenerator.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index a894c79e7..a746dbb92 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -3946,9 +3946,11 @@ void CppGenerator::finishGeneration()
s << INDENT << "}" << endl << endl;
}
- s << INDENT << "// Create an array of wrapper types for the current module." << endl;
- s << INDENT << "static PyTypeObject* cppApi[" << "SBK_" << moduleName() << "_IDX_COUNT" << "];" << endl;
- s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl;
+ if (getMaxTypeIndex()) {
+ s << INDENT << "// Create an array of wrapper types for the current module." << endl;
+ s << INDENT << "static PyTypeObject* cppApi[" << "SBK_" << moduleName() << "_IDX_COUNT" << "];" << endl;
+ s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl;
+ }
s << INDENT << "PyObject* module = Shiboken::Module::create(\"" << moduleName() << "\", ";
s << moduleName() << "_methods);" << endl << endl;
@@ -3995,7 +3997,8 @@ void CppGenerator::finishGeneration()
foreach (QByteArray type, typeResolvers)
s << INDENT << typeResolverString(type) << ';' << endl;
- s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl;
+ if (getMaxTypeIndex())
+ s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl;
s << endl << INDENT << "if (PyErr_Occurred()) {" << endl;
{