This fixes the problem that Barry reported on python-dev:
>>> 23000 .__class__ = bool
crashes in the deallocator. This was because int inherited tp_free
from object, which uses the default allocator.
2.2. Bugfix candidate.
v->ob_type->tp_free((PyObject *)v);
}
+static void
+int_free(PyIntObject *v)
+{
+ v->ob_type = (struct _typeobject *)free_list;
+ free_list = v;
+}
+
long
PyInt_AsLong(register PyObject *op)
{
0, /* tp_init */
0, /* tp_alloc */
int_new, /* tp_new */
+ (freefunc)int_free, /* tp_free */
};
void