[Python-Dev] debug and release python

Kristján Valur Jónsson kristjan at ccpgames.com
Wed Jun 16 10:35:58 CEST 2010



> -----Original Message-----
> From: Amaury Forgeot d'Arc [mailto:amauryfa at gmail.com]
> Sent: 15. júní 2010 21:24
> To: Kristján Valur Jónsson
> Cc: python-dev at python.org
> Subject: Re: [Python-Dev] debug and release python
> 
> I remember having the same issue years ago:
> http://mail.python.org/pipermail/python-list/2004-July/855844.html
> 
> At the time, I solved the issue by compiling extension modules with
> pymalloc options turned on
> (which it fortunately the default, so this applies to the supplied
> proprietary .pyd),
> and I added a (plain) definition for functions like
> _PyObject_DebugMalloc,
> even when PYMALLOC_DEBUG is undefined.
> 
> Since the python_d.dll is a custom build anyway, adding the code is
> not too much pain.
> 

It is not too much pain, once you realize the problem, no.  But I just got bitten by this and spent the best part of a weekend trying to solve the problem.  On Windows, you get an import failure on the .pyd file with the message: "Procedure entry point not found". I had come across this previously, some three years ago perhaps, and forgotten all about it, so I was sufficiently annoyed to post to python-dev.
We use python27_d.dll a lot and typically have WITH_PYMALLOC disabled in debug build to for the benefit of using the debug malloc libraries present on windows.
I've solved the issue now by making sure that obmalloc.c always exports _PyObject_DebugMalloc(), much as it always exports PyObject_Malloc() whether WITH_PYMALLOC is defined or not.

My suggestion for python core would be the same: expose these always for existing python versions, and remove them from the API in new python versions.

K



More information about the Python-Dev mailing list