1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Python Debugging Builds</title> 5<link rel="stylesheet" href="../boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../index.html" title="Boost.Python"> 8<link rel="up" href="../building.html" title="Chapter 2. Building and Testing"> 9<link rel="prev" href="include_issues.html" title="#include Issues"> 10<link rel="next" href="testing_boost_python.html" title="Testing Boost.Python"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../images/boost.png"></td></tr></table> 14<hr> 15<div class="spirit-nav"> 16<a accesskey="p" href="include_issues.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../building.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="testing_boost_python.html"><img src="../images/next.png" alt="Next"></a> 17</div> 18<div class="section"> 19<div class="titlepage"><div><div><h3 class="title"> 20<a name="building.python_debugging_builds"></a><a class="link" href="python_debugging_builds.html" title="Python Debugging Builds">Python Debugging Builds</a> 21</h3></div></div></div> 22<p> 23 Python can be built in a special “python debugging” configuration that 24 adds extra checks and instrumentation that can be very useful for developers 25 of extension modules. The data structures used by the debugging configuration 26 contain additional members, so <span class="bold"><strong>a Python executable 27 built with python debugging enabled cannot be used with an extension module 28 or library compiled without it, and vice-versa.</strong></span> 29 </p> 30<p> 31 Since pre-built “python debugging” versions of the Python executable 32 and libraries are not supplied with most distributions of Python, <a href="#ftn.building.python_debugging_builds.f0" class="footnote" name="building.python_debugging_builds.f0"><sup class="footnote">[5]</sup></a> and we didn't want to force our users to build them, Boost.Build 33 does not automatically enable python debugging in its <code class="computeroutput"><span class="identifier">debug</span></code> 34 build variant (which is the default). Instead there is a special build property 35 called <code class="computeroutput"><span class="identifier">python</span><span class="special">-</span><span class="identifier">debugging</span></code> that, when used as a build property, 36 will define the right preprocessor symbols and select the right libraries 37 to link with. 38 </p> 39<p> 40 On unix-variant platforms, the debugging versions of Python's data structures 41 will only be used if the symbol <code class="computeroutput"><span class="identifier">Py_DEBUG</span></code> 42 is defined. On many windows compilers, when extension modules are built with 43 the preprocessor symbol <code class="computeroutput"><span class="identifier">_DEBUG</span></code>, 44 Python defaults to force linking with a special debugging version of the 45 Python DLL. Since that symbol is very commonly used even when Python is not 46 present, Boost.Python temporarily undefines <code class="computeroutput"><span class="identifier">_DEBUG</span></code> 47 when <code class="computeroutput"><span class="identifier">Python</span><span class="special">.</span><span class="identifier">h</span></code> is #included from <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">python</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">wrap_python</span><span class="special">.</span><span class="identifier">hpp</span></code> - 48 unless <code class="computeroutput"><span class="identifier">BOOST_DEBUG_PYTHON</span></code> 49 is defined. The upshot is that if you want “python debugging”and you 50 aren't using Boost.Build, you should make sure <code class="computeroutput"><span class="identifier">BOOST_DEBUG_PYTHON</span></code> 51 is defined, or python debugging will be suppressed. 52 </p> 53<div class="footnotes"> 54<br><hr style="width:100; text-align:left;margin-left: 0"> 55<div id="ftn.building.python_debugging_builds.f0" class="footnote"><p><a href="#building.python_debugging_builds.f0" class="para"><sup class="para">[5] </sup></a> 56 On Unix and similar platforms, a debugging python and associated libraries 57 are built by adding --with-pydebug when configuring the Python build. On 58 Windows, the debugging version of Python is generated by the "Win32 59 Debug" target of the Visual Studio project in the PCBuild subdirectory 60 of a full Python source code distribution. 61 </p></div> 62</div> 63</div> 64<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 65<td align="left"></td> 66<td align="right"><div class="copyright-footer">Copyright © 2002-2015 David 67 Abrahams, Stefan Seefeld<br>Copyright © 2002-2015 David Abrahams, Stefan Seefeld<p> 68 Distributed under the Boost Software License, Version 1.0. (See accompanying 69 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 70 </p> 71</div></td> 72</tr></table> 73<hr> 74<div class="spirit-nav"> 75<a accesskey="p" href="include_issues.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../building.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="testing_boost_python.html"><img src="../images/next.png" alt="Next"></a> 76</div> 77</body> 78</html> 79