diff --git libshiboken/sbkenum.cpp libshiboken/sbkenum.cpp
index df3a5349..e464e3f7 100644
--- libshiboken/sbkenum.cpp
+++ libshiboken/sbkenum.cpp
@@ -527,7 +527,7 @@ PyTypeObject* newTypeWithName(const char* name, const char* cppName)
 {
     PyTypeObject* type = reinterpret_cast<PyTypeObject*>(new SbkEnumType);
     ::memset(type, 0, sizeof(SbkEnumType));
-    Py_TYPE(type) = &SbkEnumType_Type;
+    Py_SET_TYPE(type, &SbkEnumType_Type);
     type->tp_basicsize = sizeof(SbkEnumObject);
     type->tp_print = &SbkEnumObject_print;
     type->tp_repr = &SbkEnumObject_repr;
