Mailing List Archive

python/dist/src/Objects intobject.c,2.79.6.1,2.79.6.2
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv16181/Objects

Modified Files:
Tag: release22-maint
intobject.c
Log Message:
backport gvanrossum's patch:

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.

(trivial change in backport: "freefunc" -> "destructor")

Original patch(es):
python/dist/src/Objects/intobject.c:2.82



Index: intobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v
retrieving revision 2.79.6.1
retrieving revision 2.79.6.2
diff -C2 -d -r2.79.6.1 -r2.79.6.2
*** intobject.c 19 Feb 2002 14:17:02 -0000 2.79.6.1
--- intobject.c 26 Apr 2002 06:31:22 -0000 2.79.6.2
***************
*** 143,146 ****
--- 143,153 ----
}

+ static void
+ int_free(PyIntObject *v)
+ {
+ v->ob_type = (struct _typeobject *)free_list;
+ free_list = v;
+ }
+
long
PyInt_AsLong(register PyObject *op)
***************
*** 918,921 ****
--- 925,929 ----
0, /* tp_alloc */
int_new, /* tp_new */
+ (destructor)int_free, /* tp_free */
};