Get rid of most of the flags (in tp_flags) that keep track of various
variations of the type struct and its attachments.  In Py3k, all type
structs have to have all fields -- no binary backwards compatibility.
Had to change the complex object to a new-style number!
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c
index a640d52..9220866 100644
--- a/Modules/_bsddb.c
+++ b/Modules/_bsddb.c
@@ -5350,7 +5350,7 @@
     0,  		/* tp_getattro */
     0,                  /* tp_setattro */
     0,			/* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,      /* tp_flags */
+    Py_TPFLAGS_DEFAULT, /* tp_flags */
     0,                  /* tp_doc */
     0,		        /* tp_traverse */
     0,			/* tp_clear */
@@ -5383,7 +5383,7 @@
     0,  		/* tp_getattro */
     0,                  /* tp_setattro */
     0,			/* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,      /* tp_flags */
+    Py_TPFLAGS_DEFAULT, /* tp_flags */
     0,                  /* tp_doc */
     0,		        /* tp_traverse */
     0,			/* tp_clear */
@@ -5416,7 +5416,7 @@
     0,  		/* tp_getattro */
     0,                  /* tp_setattro */
     0,			/* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,      /* tp_flags */
+    Py_TPFLAGS_DEFAULT, /* tp_flags */
     0,                  /* tp_doc */
     0,		        /* tp_traverse */
     0,			/* tp_clear */
@@ -5448,7 +5448,7 @@
     0,  		/* tp_getattro */
     0,                  /* tp_setattro */
     0,			/* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,      /* tp_flags */
+    Py_TPFLAGS_DEFAULT, /* tp_flags */
     0,                  /* tp_doc */
     0,		        /* tp_traverse */
     0,			/* tp_clear */
@@ -5481,7 +5481,7 @@
     0,  		/* tp_getattro */
     0,                  /* tp_setattro */
     0,			/* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,      /* tp_flags */
+    Py_TPFLAGS_DEFAULT, /* tp_flags */
     0,                  /* tp_doc */
     0,		        /* tp_traverse */
     0,			/* tp_clear */
@@ -5514,7 +5514,7 @@
     0,  		/* tp_getattro */
     0,          /* tp_setattro */
     0,			/* tp_as_buffer */
-    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,      /* tp_flags */
+    Py_TPFLAGS_DEFAULT, /* tp_flags */
     0,          /* tp_doc */
     0,		    /* tp_traverse */
     0,			/* tp_clear */
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 336be37..c1c30f1 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -128,8 +128,6 @@
 	if (!PyType_Check(obj))
 		return NULL;
 	type = (PyTypeObject *)obj;
-	if (!PyType_HasFeature(type, Py_TPFLAGS_HAVE_CLASS))
-		return NULL;
 	if (!type->tp_dict || !StgDict_Check(type->tp_dict))
 		return NULL;
 	return (StgDictObject *)type->tp_dict;
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 54abb89..7b23210 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -219,7 +219,7 @@
 	PyObject_GenericSetAttr,	/* tp_setattro */
 	0,				/* tp_as_buffer */
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
-		Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS,	/* tp_flags */
+		Py_TPFLAGS_BASETYPE,	/* tp_flags */
 	partial_doc,			/* tp_doc */
 	(traverseproc)partial_traverse,	/* tp_traverse */
 	0,				/* tp_clear */
diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c
index 6ee8bea..95a4931 100644
--- a/Modules/_sqlite/cursor.c
+++ b/Modules/_sqlite/cursor.c
@@ -998,7 +998,7 @@
         0,                                              /* tp_getattro */
         0,                                              /* tp_setattro */
         0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_ITER|Py_TPFLAGS_BASETYPE, /* tp_flags */
+        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,	/* tp_flags */
         cursor_doc,                                     /* tp_doc */
         0,                                              /* tp_traverse */
         0,                                              /* tp_clear */
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 55923e7..4e45636 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -403,7 +403,7 @@
         0,                                              /* tp_getattro */
         0,                                              /* tp_setattro */
         0,                                              /* tp_as_buffer */
-        Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS,  /* tp_flags */
+        Py_TPFLAGS_DEFAULT,				/* tp_flags */
         0,                                              /* tp_doc */
         0,                                              /* tp_traverse */
         0,                                              /* tp_clear */
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 42e0c20..d4e6051 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -2628,7 +2628,7 @@
     0,					/* tp_getattro */
     0,					/* tp_setattro */
     0,					/* tp_as_buffer */
-    Py_TPFLAGS_HAVE_WEAKREFS,		/* tp_flags */
+    Py_TPFLAGS_DEFAULT,			/* tp_flags */
     pattern_doc,			/* tp_doc */
     0,					/* tp_traverse */
     0,					/* tp_clear */
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 3a44bde..df243ec 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1706,7 +1706,7 @@
 	PyObject_GenericGetAttr,	/* tp_getattro */
 	PyObject_GenericSetAttr,	/* tp_setattro */
 	0,					/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS,/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
 	s__doc__,			/* tp_doc */
 	0,					/* tp_traverse */
 	0,					/* tp_clear */
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index af12769..100b341 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1570,13 +1570,11 @@
 	return s;
 }
 
-#define HASINDEX(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_HAVE_INDEX)
-
 static PyObject*
 array_subscr(arrayobject* self, PyObject* item)
 {
 	PyNumberMethods *nb = item->ob_type->tp_as_number;
-	if (nb != NULL && HASINDEX(item) && nb->nb_index != NULL) {
+	if (nb != NULL && nb->nb_index != NULL) {
 		Py_ssize_t i = nb->nb_index(item);
 		if (i==-1 && PyErr_Occurred()) {
 			return NULL;
@@ -1626,7 +1624,7 @@
 array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
 {
 	PyNumberMethods *nb = item->ob_type->tp_as_number;
-	if (nb != NULL && HASINDEX(item) && nb->nb_index != NULL) {
+	if (nb != NULL && nb->nb_index != NULL) {
 		Py_ssize_t i = nb->nb_index(item);
 		if (i==-1 && PyErr_Occurred()) 
 			return -1;
@@ -1984,7 +1982,7 @@
 	PyObject_GenericGetAttr,		/* tp_getattro */
 	0,					/* tp_setattro */
 	&array_as_buffer,			/* tp_as_buffer*/
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS,  /* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
 	arraytype_doc,				/* tp_doc */
  	0,					/* tp_traverse */
 	0,					/* tp_clear */
diff --git a/Modules/collectionsmodule.c b/Modules/collectionsmodule.c
index c7e2c85..0c7dca6 100644
--- a/Modules/collectionsmodule.c
+++ b/Modules/collectionsmodule.c
@@ -846,8 +846,8 @@
 	PyObject_GenericGetAttr,	/* tp_getattro */
 	0,				/* tp_setattro */
 	0,				/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
-		Py_TPFLAGS_HAVE_WEAKREFS,	/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+		 Py_TPFLAGS_HAVE_GC,	/* tp_flags */
 	deque_doc,			/* tp_doc */
 	(traverseproc)deque_traverse,	/* tp_traverse */
 	(inquiry)deque_clear,		/* tp_clear */
@@ -1299,8 +1299,8 @@
 	PyObject_GenericGetAttr,	/* tp_getattro */
 	0,				/* tp_setattro */
 	0,				/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
-		Py_TPFLAGS_HAVE_WEAKREFS,	/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE |
+		Py_TPFLAGS_HAVE_GC,	/* tp_flags */
 	defdict_doc,			/* tp_doc */
 	defdict_traverse,		/* tp_traverse */
 	(inquiry)defdict_tp_clear,	/* tp_clear */
diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c
index 760ab31..5dcd6a4 100644
--- a/Modules/datetimemodule.c
+++ b/Modules/datetimemodule.c
@@ -2141,8 +2141,7 @@
 	PyObject_GenericGetAttr,			/* tp_getattro */
 	0,						/* tp_setattro */
 	0,						/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
-	        Py_TPFLAGS_BASETYPE,			/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,	/* tp_flags */
 	delta_doc,					/* tp_doc */
 	0,						/* tp_traverse */
 	0,						/* tp_clear */
@@ -2698,8 +2697,7 @@
 	PyObject_GenericGetAttr,			/* tp_getattro */
 	0,						/* tp_setattro */
 	0,						/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
-        Py_TPFLAGS_BASETYPE,				/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,	/* tp_flags */
 	date_doc,					/* tp_doc */
 	0,						/* tp_traverse */
 	0,						/* tp_clear */
@@ -2954,8 +2952,7 @@
 	PyObject_GenericGetAttr,		/* tp_getattro */
 	0,					/* tp_setattro */
 	0,					/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
-        Py_TPFLAGS_BASETYPE,			/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
 	tzinfo_doc,				/* tp_doc */
 	0,					/* tp_traverse */
 	0,					/* tp_clear */
@@ -3473,8 +3470,7 @@
 	PyObject_GenericGetAttr,		/* tp_getattro */
 	0,					/* tp_setattro */
 	0,					/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
-        Py_TPFLAGS_BASETYPE,			/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
 	time_doc,				/* tp_doc */
 	0,					/* tp_traverse */
 	0,					/* tp_clear */
@@ -4568,8 +4564,7 @@
 	PyObject_GenericGetAttr,		/* tp_getattro */
 	0,					/* tp_setattro */
 	0,					/* tp_as_buffer */
-	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES |
-        Py_TPFLAGS_BASETYPE,			/* tp_flags */
+	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
 	datetime_doc,				/* tp_doc */
 	0,					/* tp_traverse */
 	0,					/* tp_clear */
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 19970c9..d7a8944 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -800,13 +800,11 @@
 	0,					/*tp_getattro*/
 	0,					/*tp_setattro*/
 	&mmap_as_buffer,			/*tp_as_buffer*/
-	Py_TPFLAGS_HAVE_GETCHARBUFFER,		/*tp_flags*/
+	Py_TPFLAGS_DEFAULT,			/*tp_flags*/
 	0,					/*tp_doc*/
 };
 
 
-#define HASINDEX(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_HAVE_INDEX)
-
 /* extract the map size from the given PyObject
 
    Returns -1 on error, with an appropriate Python exception raised. On
@@ -815,7 +813,7 @@
 _GetMapSize(PyObject *o)
 {
 	PyNumberMethods *nb = o->ob_type->tp_as_number;
-	if (nb != NULL && HASINDEX(o) && nb->nb_index != NULL) {
+	if (nb != NULL && nb->nb_index != NULL) {
 		Py_ssize_t i = nb->nb_index(o);
 		if (i==-1 && PyErr_Occurred()) 
 			return -1;