Mailing List Archive

python/dist/src/Objects intobject.c,2.81,2.82
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv4281

Modified Files:
intobject.c
Log Message:
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.


Index: intobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v
retrieving revision 2.81
retrieving revision 2.82
diff -C2 -d -r2.81 -r2.82
*** intobject.c 3 Apr 2002 22:41:51 -0000 2.81
--- intobject.c 26 Apr 2002 00:53:34 -0000 2.82
***************
*** 131,134 ****
--- 131,141 ----
}

+ static void
+ int_free(PyIntObject *v)
+ {
+ v->ob_type = (struct _typeobject *)free_list;
+ free_list = v;
+ }
+
long
PyInt_AsLong(register PyObject *op)
***************
*** 906,909 ****
--- 913,917 ----
0, /* tp_alloc */
int_new, /* tp_new */
+ (freefunc)int_free, /* tp_free */
};