Bug 30289 - PyCObject API deprecated in 2.7, removed from 3.2
Summary: PyCObject API deprecated in 2.7, removed from 3.2
Status: RESOLVED FIXED
Alias: None
Product: pycairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Steve Chaplin
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-20 12:36 UTC by John (J5) Palmieri
Modified: 2011-03-27 05:42 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
use PyCapsule API instead of the deprecated PyCObject API (1.28 KB, patch)
2010-09-28 12:54 UTC, John (J5) Palmieri
Details | Splinter Review

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.