Bug 30289

Summary: PyCObject API deprecated in 2.7, removed from 3.2
Product: pycairo Reporter: John (J5) Palmieri <johnp>
Component: generalAssignee: Steve Chaplin <d74n5pohf9>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: use PyCapsule API instead of the deprecated PyCObject API

Description John (J5) Palmieri 2010-09-20 12:36:36 UTC
See bug https://bugzilla.redhat.com/show_bug.cgi?id=623858

The PyCObject API has been deprecated in Python 2.7 and is being removed entirely in Python 3.2.

$> cd pycairo
$> grep -r PyCObject *

src/py3cairo.h:        Pycairo_CAPI = (Pycairo_CAPI_t*)
PyCObject_Import("cairo", "CAPI")
src/cairomodule.c:  PyModule_AddObject(m, "CAPI", PyCObject_FromVoidPtr(&CAPI,
NULL));
test/include/pycairo/py3cairo.h:        Pycairo_CAPI = (Pycairo_CAPI_t*)
PyCObject_Import("cairo", "CAPI")

PyCapsules should be used now:

http://docs.python.org/py3k/c-api/capsule.html#capsules
Comment 1 John (J5) Palmieri 2010-09-28 12:54:57 UTC
Created attachment 39029 [details] [review]
use PyCapsule API instead of the deprecated PyCObject API

* PyCObject is deprecated in 3.1 and removed in 3.2
Comment 2 John (J5) Palmieri 2010-09-28 12:57:05 UTC
A similar patch should be added to py2cairo but you will need conditionals since PyCapsule was added in 2.7.  It isn't as big a deal for py2cairo since I don't think they are going to remove PyCObject even though they deprecated it.
Comment 3 John (J5) Palmieri 2010-10-25 14:59:02 UTC
ping
Comment 4 Steve Chaplin 2011-03-27 05:42:40 UTC
Changes have been applied to git for python 3 cairo (python 2 cairo does not need to the changes).
I used another equivalent patch which more closely followed the example in the Python docs and uses an 'import_cairo' function.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.