[cairo] pycairo fails with python 3.2

Steve stevech1097 at yahoo.com.au
Wed Mar 30 03:50:29 PDT 2011


On Sun, 2011-03-27 at 16:00 +0000, Fons Adriaensen wrote:
> Hello Steve,
> 
> > Thanks for the patch, its been applied to git.
> > I had a problem with waf configure with Python 3.2 also - I think it may
> > be a waf bug.
> 
> It could be related to the new naming scheme for *.pyc and *.so
> used in 3.2.
I think it is - Python 3.2 has made a naming change which is incompatible
with earlier versions of python 3 and python 2. I think that was a
mistake which will cause problems for lots of people. The change should
have occurred at version python 3.0.

Waf can be patched to get it to work with Python 3.2, see
https://code.google.com/p/waf/issues/detail?id=915


> My main area of activity is audio software, I never imagined I
> would be contributing a patch to pycairo ! But I needed a 
> solution quickly, so I had to write it...
> 
> Note that the way other C extensions are supposed to import
> the C API of pycairo has changed with this patch. I followed
> the style used by the examples in the Pyton manual.
> 
> That means there are two changes:
> 
> 1. The static pointer to the C API is now declared in py3cairo.h
> instead of in the code of the module doing the import, and 
> 
> 2. and it is initialised by function call instead of the macro
> used previously.
> 
> I don't like (1) very much, but it's a consequence of (2), you
> get a chicken-egg situation otherwise.
> 
> It would be possible to revert to the old method if the pycairo
> devs prefer it. Otherwise the change should be documented in
> a CHANGELOG or similar.

I've updated the pycairo docs to give an example of the new method.
I prefer to follow the method described in the Python manual, even
though it differs from earlier versions of pycairo. I think that forcing
the usage of PyCapsule in 3.2 and dropping support for the method
which worked in versions up to 3.1 was another mistake by the python
developers that will cause problems for developers and users of python
extension modules.

Steve




More information about the cairo mailing list