Non-function fields, like tp_dictoffset and tp_weaklistoffset, should
be inherited in inherit_special(), otherwise dynamic types don't
inherit these.

Also added some XXX comments about open ends.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index e8b634e..8f48b39 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -852,6 +852,7 @@
 }
 
 #if 0
+/* XXX These should be made smarter before they can be used */
 static PyObject *
 object_repr(PyObject *self)
 {
@@ -1036,6 +1037,20 @@
 		}
 	}
 	PyType_SET_BASICSIZE(type, newsize);
+
+	/* Copy other non-function slots */
+
+#undef COPYVAL
+#define COPYVAL(SLOT) \
+	if (type->SLOT == 0) type->SLOT = base->SLOT
+
+	COPYVAL(tp_itemsize);
+	if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_WEAKREFS) {
+		COPYVAL(tp_weaklistoffset);
+	}
+	if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_CLASS) {
+		COPYVAL(tp_dictoffset);
+	}
 }
 
 static void
@@ -1136,7 +1151,6 @@
 
 	basebase = base->tp_base;
 
-	COPYSLOT(tp_itemsize);
 	COPYSLOT(tp_dealloc);
 	COPYSLOT(tp_print);
 	if (type->tp_getattr == NULL && type->tp_getattro == NULL) {
@@ -1153,7 +1167,6 @@
 	COPYSLOT(tp_call);
 	COPYSLOT(tp_str);
 	COPYSLOT(tp_as_buffer);
-	COPYSLOT(tp_flags);
 	if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE) {
 		if (type->tp_compare == NULL && type->tp_richcompare == NULL) {
 			type->tp_compare = base->tp_compare;
@@ -1163,9 +1176,6 @@
 	else {
 		COPYSLOT(tp_compare);
 	}
-	if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_WEAKREFS) {
-		COPYSLOT(tp_weaklistoffset);
-	}
 	if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_ITER) {
 		COPYSLOT(tp_iter);
 		COPYSLOT(tp_iternext);
@@ -2244,6 +2254,8 @@
 static int
 slot_nb_nonzero(PyObject *self)
 {
+	/* XXX This should cope with a missing __nonzero__ */
+	/* XXX Should it also look for __len__? */
 	PyObject *res = PyObject_CallMethod(self, "__nonzero__", "");
 
 	if (res == NULL)
@@ -2283,6 +2295,7 @@
 static int
 slot_tp_compare(PyObject *self, PyObject *other)
 {
+	/* XXX Should this cope with a missing __cmp__? */
 	PyObject *res = PyObject_CallMethod(self, "__cmp__", "O", other);
 	long r;
 
@@ -2293,11 +2306,13 @@
 	return (int)r;
 }
 
+/* XXX This should cope with a missing __repr__, and also look for __str__ */
 SLOT0(slot_tp_repr, "__repr__")
 
 static long
 slot_tp_hash(PyObject *self)
 {
+	/* XXX This should cope with a missing __hash__ */
 	PyObject *res = PyObject_CallMethod(self, "__hash__", "");
 	long h;
 
@@ -2322,6 +2337,7 @@
 	return res;
 }
 
+/* XXX This should cope with a missing __str__, and also look for __repr__ */
 SLOT0(slot_tp_str, "__str__")
 
 static PyObject *
@@ -2371,6 +2387,7 @@
 static PyObject *
 slot_tp_richcompare(PyObject *self, PyObject *other, int op)
 {
+	/* XXX How should this cope with missing __xx__? */
 	PyObject *meth = PyObject_GetAttrString(self, name_op[op]);
 	PyObject *res;