title: Install libxml2 bindings for python3
body: <h2>The Problem</h2>
  
  <p>I’m trying to build <code>libxml</code> (<code>libxml2-2.7.8</code>) bindings for Python 3.2.  When I run the following:</p>
  
  <pre><code>./configure --with-python=/usr/bin/python3.2
  </code></pre>
  
  <p>The compilation of <code>libxml2-2.7.8</code> works...but the Python bindings for <code>libxml2-2.7.8</code> don’t!</p>
  
  <h2>Attempted Fixes</h2>
  
  <ol>
  <li>Ported <code>setup.py</code> and <code>generator.py</code> (using <code>2to3</code>, and some basic patches on <code>generator.py</code>)</li>
  <li>Patched <code>libxml.c</code> and <code>types.c</code> as follows:
  <ul>
  <li>replace PyInt* by PyLong* </li>
  <li>replace PyString* by PyBytes*</li>
  </ul></li>
  </ol>
  
  <h2>Current Situation</h2>
  
  <p>Unfortunately, it still wasn’t enough.  I ran <code>python3.2 setup.py build</code> and got the following error:</p>
  
  <pre><code>types.c:594:17: error: ‘PyInstanceObject’ undeclared (first use in this function)
  </code></pre>
  
  <p>I can’t find the Python3 equivalent of <code>PyInstanceObject</code>!</p>
  
  <p><strong>Has anyone managed to compile <code>libxml2</code> bindings for Python 3?</strong></p>
  
  <p><strong>Did I miss something???  Can anybody help? :(</strong></p>