[Patches] [ python-Patches-536909 ] pymalloc for types and other cleanups

noreply@sourceforge.net noreply@sourceforge.net
Fri, 29 Mar 2002 15:09:23 -0800


Patches item #536909, was opened at 2002-03-29 21:11
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=536909&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Neil Schemenauer (nascheme)
Assigned to: Tim Peters (tim_one)
Summary: pymalloc for types and other cleanups

Initial Comment:
This patch changes typeobject to use pymalloc for
managing the memory of subclassable types. It also
fixes a bug that caused an interpreter built without
GC to crash.

Testing this patch was a bitch.  There are three knobs
related to MM now (with-cycle-gc, with-pymalloc,
and PYMALLOC_DEBUG).  I think I found different bugs
when testing with each possible combination.

There's one bit of ugliness in this patch.  Extension
module writers have to use _PyMalloc_Del to initialize
the tp_free pointer.  There should be a "public"
function for that.

----------------------------------------------------------------------

>Comment By: Neil Schemenauer (nascheme)
Date: 2002-03-29 23:09

Message:
Logged In: YES 
user_id=35752

I'm counting on Tim to finish PyMem_NukeIt.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-03-29 22:47

Message:
Logged In: YES 
user_id=21627

I see another memory allocation family here: What function
should objects allocated through PyType_GenericAlloc be
released with?

If you change the behaviour of PyType_GenericAlloc, all
types in extensions written for 2.2 that use
PyType_GenericAlloc will break, since they will still have
PyObject_Del in their tp_free slot.

I believe "families" should always be complete, so along
with PyType_GenericAlloc goes PyType_GenericFree.

If you want it fully backwards compatible, you need to
introduce PyType_PyMallocAlloc...

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=536909&group_id=5470