Browse Source

Fix Python 3 build issue with iterator extensions

rdb 11 years ago
parent
commit
5b967671fa
1 changed files with 2 additions and 0 deletions
  1. 2 0
      dtool/src/interrogate/interfaceMakerPythonNative.cxx

+ 2 - 0
dtool/src/interrogate/interfaceMakerPythonNative.cxx

@@ -1962,7 +1962,9 @@ write_module_class(ostream &out, Object *obj) {
 
 
   // Add flags.
   // Add flags.
   if (obj->_protocol_types & Object::PT_iter) {
   if (obj->_protocol_types & Object::PT_iter) {
+    out << "#if PY_VERSION_HEX < 0x03000000\n";
     out << "    Dtool_" << ClassName << ".As_PyTypeObject().tp_flags |= Py_TPFLAGS_HAVE_ITER;\n";
     out << "    Dtool_" << ClassName << ".As_PyTypeObject().tp_flags |= Py_TPFLAGS_HAVE_ITER;\n";
+    out << "#endif";
   }
   }
   if (has_local_getbuffer) {
   if (has_local_getbuffer) {
     out << "#if PY_VERSION_HEX >= 0x02060000 && PY_VERSION_HEX < 0x03000000\n";
     out << "#if PY_VERSION_HEX >= 0x02060000 && PY_VERSION_HEX < 0x03000000\n";