using C's "assert" macro in extension code

Gerhard Häring gh at
Wed Mar 26 19:45:50 CET 2003

* Maciej Kalisiak <mac at> [2003-03-26 18:28 +0000]:
> I tend to litter my experimental code with a healthy dose of "assert"
> statements, and writing Python extensions is no exception.  I've recently
> noticed that my asserts are not being executed, which led me to realize that
> the Makefile created by "make -f boot" always uses "-DNDEBUG",
> which disables the assert macro. [...]

NDEBUG is only defined in release builds of Python (and also extension
modules, via distutils). If you create a debug build of Python, NDEBUG
won't be defined and your asserts will work again.


mail:   gh at

More information about the Python-list mailing list