Also notice that this *does* make use of new-style classes: In 2.1, types did not have a tp_dict slot. Of course, the PyType_Ready call should go immediately before the place where tp_dict is accessed, and a check should be added whether tp_flags contains Py_TPFLAGS_HAVE_CLASS.
Wouldn't it suffice to check for tp_dict != NULL (after the call to PyType_Ready of course)?
Hm. What does Py_TPFLAGS_HAVE_CLASS mean exactly? Or, better, since TPFLAGS_DEFAULT contains TPFLAGS_HAVE_CLASS, what does it mean when Py_TPFLAGS_HAVE_CLASS is NOT in tp_flags? Does it mean that this is a 'new style' type object?