### Python Debugging Builds

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, [5] and we didn't want to force our users to build them, Boost.Build does not automatically enable python debugging in its `debug` build variant (which is the default). Instead there is a special build property called `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 `Py_DEBUG` is defined. On many windows compilers, when extension modules are built with the preprocessor symbol `_DEBUG`, 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 `_DEBUG` when `Python.h` is #included from `boost/python/detail/wrap_python.hpp` - unless `BOOST_DEBUG_PYTHON` is defined. The upshot is that if you want “python debugging”and you aren't using Boost.Build, you should make sure `BOOST_DEBUG_PYTHON` is defined, or python debugging will be suppressed.

[5] 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.