diff --git a/Framework/PythonInterface/core/inc/MantidPythonInterface/core/VersionCompat.h b/Framework/PythonInterface/core/inc/MantidPythonInterface/core/VersionCompat.h
index 3ebff5f6707b932f1e7b4b242b896e47445a9559..2ca2f7ffc882a6c752bb78366a37bc77d443d967 100644
--- a/Framework/PythonInterface/core/inc/MantidPythonInterface/core/VersionCompat.h
+++ b/Framework/PythonInterface/core/inc/MantidPythonInterface/core/VersionCompat.h
@@ -20,6 +20,7 @@
 #define FROM_CSTRING PyUnicode_FromString
 #define CODE_OBJECT(x) x
 #else
+#define IS_PY2K
 #define INT_CHECK PyInt_Check
 #define TO_LONG PyInt_AsLong
 #define STR_CHECK PyString_Check
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp
index a07add6f07db2fe2d3be67a1ff3d89cdfe8735b5..f8cb7fbf5e493531de1e205561726269c72b9990 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp
@@ -19,10 +19,10 @@ void export_ComponentInfoPythonIterator() {
   // Export to Python
   class_<ComponentInfoPythonIterator>("ComponentInfoPythonIterator", no_init)
       .def("__iter__", objects::identity_function())
-#ifdef IS_PY3K
-      .def("__next__", &ComponentInfoPythonIterator::next)
-#else
+#ifdef IS_PY2K
       .def("next", &ComponentInfoPythonIterator::next)
+#else
+      .def("__next__", &ComponentInfoPythonIterator::next)
 #endif
       ;
 }
diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp
index 0c7db21d73591acce9aea5acdf57eb8a0651edef..2cf6fc8bc1cd944aa4aa0ec941e543cdf59db603 100644
--- a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp
+++ b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp
@@ -19,10 +19,10 @@ void export_DetectorInfoPythonIterator() {
   // Export to Python
   class_<DetectorInfoPythonIterator>("DetectorInfoPythonIterator", no_init)
       .def("__iter__", objects::identity_function())
-#ifdef IS_PY3K
-      .def("__next__", &DetectorInfoPythonIterator::next)
-#else
+#ifdef IS_PY2K
       .def("next", &DetectorInfoPythonIterator::next)
+#else
+      .def("__next__", &DetectorInfoPythonIterator::next)
 #endif
       ;
 }