mirror of https://github.com/python/cpython
Make sure that tp_free frees the int the same way as tp_dealloc would.
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.
This commit is contained in:
parent
cf22c826a6
commit
9364698101
|
@ -130,6 +130,13 @@ int_dealloc(PyIntObject *v)
|
||||||
v->ob_type->tp_free((PyObject *)v);
|
v->ob_type->tp_free((PyObject *)v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
int_free(PyIntObject *v)
|
||||||
|
{
|
||||||
|
v->ob_type = (struct _typeobject *)free_list;
|
||||||
|
free_list = v;
|
||||||
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
PyInt_AsLong(register PyObject *op)
|
PyInt_AsLong(register PyObject *op)
|
||||||
{
|
{
|
||||||
|
@ -905,6 +912,7 @@ PyTypeObject PyInt_Type = {
|
||||||
0, /* tp_init */
|
0, /* tp_init */
|
||||||
0, /* tp_alloc */
|
0, /* tp_alloc */
|
||||||
int_new, /* tp_new */
|
int_new, /* tp_new */
|
||||||
|
(freefunc)int_free, /* tp_free */
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue