diff -r 174e4ee15ad1 Objects/typeobject.c --- a/Objects/typeobject.c Sun Aug 19 14:41:50 2012 +0200 +++ b/Objects/typeobject.c Sun Aug 19 14:49:54 2012 +0200 @@ -2377,6 +2377,15 @@ #include "typeslots.inc" }; +static PyObject * +PySpec_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) +{ + PyErr_Format(PyExc_TypeError, + "cannot create '%.100s' instances", + type->tp_name); + return NULL; +} + PyObject * PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases) { @@ -2385,7 +2394,7 @@ char *s; char *res_start = (char*)res; PyType_Slot *slot; - + /* Set the type name and qualname */ s = strrchr(spec->name, '.'); if (s == NULL) @@ -2406,7 +2415,7 @@ type->tp_name = spec->name; if (!type->tp_name) goto fail; - + /* Adjust for empty tuple bases */ if (!bases) { base = &PyBaseObject_Type; @@ -2439,6 +2448,10 @@ goto fail; } +// if(!type->tp_new){ + // type->tp_new = PySpec_new; + // } + /* Initialize essential fields */ type->tp_as_number = &res->as_number; type->tp_as_sequence = &res->as_sequence;