[cairo] pycairo fails with python 3.2

Fons Adriaensen fons at linuxaudio.org
Sun Mar 27 09:00:56 PDT 2011

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.

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.


Fons Adriaensen

More information about the cairo mailing list