Python can be built in a special “python debugging” configuration that adds extra checks and instrumentation that can be very useful for developers of extension modules. The data structures used by the debugging configuration contain additional members, so a Python executable built with python debugging enabled cannot be used with an extension module or library compiled without it, and vice-versa.
Since pre-built “python debugging” versions of the Python executable
and libraries are not supplied with most distributions of Python,  and we didn't want to force our users to build them, Boost.Build
does not automatically enable python debugging in its
build variant (which is the default). Instead there is a special build property
python-debugging that, when used as a build property,
will define the right preprocessor symbols and select the right libraries
to link with.
On unix-variant platforms, the debugging versions of Python's data structures
will only be used if the symbol
is defined. On many windows compilers, when extension modules are built with
the preprocessor symbol
Python defaults to force linking with a special debugging version of the
Python DLL. Since that symbol is very commonly used even when Python is not
present, Boost.Python temporarily undefines
Python.h is #included from
is defined. The upshot is that if you want “python debugging”and you
aren't using Boost.Build, you should make sure
is defined, or python debugging will be suppressed.
 On Unix and similar platforms, a debugging python and associated libraries are built by adding --with-pydebug when configuring the Python build. On Windows, the debugging version of Python is generated by the "Win32 Debug" target of the Visual Studio project in the PCBuild subdirectory of a full Python source code distribution.