[Python-Dev] pymalloc API - is 1.5.2 compatibility a possible explanation?

M.-A. Lemburg mal@lemburg.com
Tue, 19 Mar 2002 10:05:19 +0100


Skip Montanaro wrote:
> 
> 1.5.2 rears its ugly head again...
> 
> Neil S. reported on a number of 3rd party extension modules that don't do
> object alloc/free properly.  I reported a bug to the mysql-python project,
> which uses PyObject_NEW and PyMem_Free.  Andy Dustman's reply, in part, was:
> 
>     1.5.2 apparently does not have PyObject_New() or PyObject_Del(), thus
>     the problem...
> 
> The thread is here:
> 
>   http://sourceforge.net/tracker/?func=detail&atid=374932&aid=531671&group_id=22307
> 
> Check here for Andy's proposed patch to _mysql.c (ignore the non-alloc
> stuff):
> 
>   http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/mysql-python/MySQLdb/_mysql.c.diff?r1=1.16&r2=1.22
> 
> It would appear at least some of the breakage stems from actual or perceived
> differences in the object allocation API between 1.5.2 and 2.x.

FWIW, I use a special #define in the mx tools which allows
using the Python 2.x macros in 1.5.2 as well:

#if PY_VERSION_HEX < 0x01060000

#if !defined(PyObject_DEL)
# define PyObject_DEL(x) free(x)
# define PyObject_Del(x) free(x)
#endif

#endif

Still, the potential code breakage looks frightening for a minor
release... I would guess that quite a few of the older modules
are not being maintained anymore.

Isn't there anything we can do about this ? E.g. redirect the
macros to functions which do all the necessary magic to have
pymalloc enabled and redirect to system malloc()/free() for
all non-Python object pointers ?!

-- 
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Company & Consulting:                           http://www.egenix.com/
Python Software:                   http://www.egenix.com/files/python/