diff options
Diffstat (limited to 'generator')
-rw-r--r-- | generator/cppgenerator.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp index 97da37d4a..7142abc75 100644 --- a/generator/cppgenerator.cpp +++ b/generator/cppgenerator.cpp @@ -3946,8 +3946,11 @@ void CppGenerator::finishGeneration() } 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; + int maxTypeIndex = getMaxTypeIndex(); + if (maxTypeIndex) { + s << INDENT << "static PyTypeObject* cppApi[SBK_" << moduleName() << "_IDX_COUNT];" << endl; + s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl; + } s << "#ifdef IS_PY3K" << endl; s << INDENT << "PyObject* module = Shiboken::Module::create(\"" << moduleName() << "\", &moduledef);" << endl; @@ -3998,7 +4001,8 @@ void CppGenerator::finishGeneration() foreach (QByteArray type, typeResolvers) s << INDENT << typeResolverString(type) << ';' << endl; - s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl; + if (maxTypeIndex) + s << endl << INDENT << "Shiboken::Module::registerTypes(module, " << cppApiVariableName() << ");" << endl; s << endl << INDENT << "if (PyErr_Occurred()) {" << endl; { |