[arch-general] Python 3.2mu breaks pycairo ?

Fons Adriaensen fons at linuxaudio.org
Tue Mar 22 20:24:11 EDT 2011


Hello all,

A full system update yesterday replaced Python 3.1 by 3.2mu
(what does the 'mu' mean BTW) and this seems to break pycairo:

Traceback (most recent call last):
  File "./mkmeter.py", line 3, in <module>
    from cairo import *
  File "/usr/lib/python3.2/site-packages/cairo/__init__.py", line 18, in <module>
    from ._cairo import *
ImportError: /usr/lib/python3.2/site-packages/cairo/_cairo.cpython-32mu.so: undefined symbol: PyCObject_FromVoidPtr

And indeed PyCObject_FromVoidPtr() and its inverse, PyCObject_AsVoidPtr()
are no longer available in Python 3.2.

They can be replaced by

P = PyCObject_FromVoidPtr(X, destroy) --> P = PyCapsule_New(X, 0, destroy)
X = PyCObject_AsVoidPtr(P)            --> X = PyCapsule_GetPointer(P, 0)

and the 'destroy' function now takes a PyObject* instead of PyCObject*,
so you have to use PyCapsule_GetPointer() inside it to get the C/C++
pointer.

Ciao,

-- 
FA



More information about the arch-general mailing list