title: How to deal with PyCapsule type inside Python
body: <p>I'm trying to pass the object from </p>
  
  <pre><code>QtGui.QWidget.effectiveWinId() 
  </code></pre>
  
  <p>to</p>
  
  <pre><code>win32gui.SetWindowLong()
  </code></pre>
  
  <p>effectiveWinId() is returning:</p>
  
  <pre><code>&lt;capsule object NULL at 0x027C9BF0&gt;
  &lt;class 'PyCapsule'&gt;
  </code></pre>
  
  <p>and SetWindowLong() expects a PyHANDLE (doc says it "should" accept an integer also)</p>
  
  <pre><code>TypeError: The object is not a PyHANDLE object
  </code></pre>
  
  <p>So my question is how do I grab the value out of a PyCapsule object and or check if its NULL? It seems PyCapsule is all internal API to the C code.</p>
  
  <p>Also I found this bug that does something similar to what I want with Python's 2.X PyCObject which doesn't exist in Python 3.x here: <a href="http://srinikom.github.io/pyside-bz-archive/show_bug.cgi?id=523#c18" rel="nofollow">http://srinikom.github.io/pyside-bz-archive/show_bug.cgi?id=523#c18</a></p>