I am writing a Python class in C and I want to put statements in my debugging code. assert.h suits me. This is only added to the debug compilation, so there is no chance that an assert failure will not affect the user of the Python * code.
I am trying to separate my "library" code (which should be separate for Python-related code), so I can use it from another C code. My Python methods are, therefore, thin wrappers around my pure-C code.
Therefore, I cannot do this in my "library" code:
if (black == white) { PyErr_SetString(PyExc_RuntimeError, "Remap failed"); }
because it pollutes my pure-C code using Python. It is also much uglier than simple
assert(black != white);
I believe that the Distutils compiler always installs NDEBUG , which means that I cannot use assert.h even in debug builds.
Mac OS and Linux.
Help!
* one argument that I heard against a statement in C code called from Python.
source share