[Python-Dev] NDEBUG in Python.h

Robin Dunn robin@alldunn.com
Mon, 19 Nov 2001 14:29:30 -0800


Hi everyone (python-dev and wx-dev),

I'm wondering if any other extension writers are having problems with this
code that was added to Python.h for 2.2?

#ifndef Py_DEBUG
#ifndef NDEBUG
#define NDEBUG 1
#endif
#endif

The problem is that if you want to link debug libraries with a non-debug
Python then the extension module code will see the above in Python.h and it
will possibly effect what it expects in the debug library it is linked with.
In my case I end up with differences in the expected vs. actual vtables and
so the wrong virtual methods are called followed shortly by a core dump.

If I have to I can make changes in my code or maybe in wxWindows to get
around this, but it was my understanding that NDEBUG should always be set in
the compile options and never in header files to avoid this very problem.

Comments?

--
Robin Dunn
Software Craftsman
robin@AllDunn.com       Java give you jitters?
http://wxPython.org      Relax with wxPython!