Bug 623858

Summary: pycairo uses PyCObject API (deprecated in Python 2.7)
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: pycairoAssignee: John (J5) Palmieri <johnp>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: extras-orphan, jkeck
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-18 20:38:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 620842    

Description Dave Malcolm 2010-08-13 01:07:26 UTC
Description of problem:
Python 2.7 deprecated the PyCObject API in favor of a new "capsule" API.
  http://docs.python.org/dev/whatsnew/2.7.html#capsules

The deprecations are set to "ignore" by default, so in theory the API still works.

However the deprecation has caused at least one app to fail (virt-manager, see bug 620216, due to it modifying the warning settings), so I've been doublechecking the scope of usage of the PyCObject API, and am filing bugs against components that are possibly affected.

You can trigger a hard failure of the API via:
>>> import warnings
>>> warnings.filterwarnings('error')
>>> import cairo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/cairo/__init__.py", line 1, in <module>
    from _cairo import *
PendingDeprecationWarning: The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.
>>> dir(cairo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'cairo' is not defined

I'm not yet sure what the best approach is to fixing this.


Version-Release number of selected component (if applicable):
pycairo-1.8.8-2.fc14.src.rpm

Grepping the prepped source tree shows these uses:
./pycairo-1.8.8/src/cairomodule.c:305:  PyModule_AddObject(m, "CAPI", PyCObject_FromVoidPtr(&CAPI, NULL));
./pycairo-1.8.8/src/pycairo.h:204:        Pycairo_CAPI = (Pycairo_CAPI_t*) PyCObject_Import("cairo", "CAPI")

Note the usage within a header file; I wonder if this leads to further knock-on effects?

Comment 1 Fedora Admin XMLRPC Client 2010-08-21 06:51:54 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Fedora Admin XMLRPC Client 2011-08-18 20:05:52 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 John (J5) Palmieri 2011-08-18 20:38:08 UTC
This should be fixed.  First for 2.7 we keep using CObjects so we don't have to disrupt the world of packages that link to this.  In 3.x we switched to PyCapsule.  Latest versions of PyCairo "do the right thing"(tm)

Comment 4 John (J5) Palmieri 2011-08-18 20:40:53 UTC
And when I say fixed, I mean we deal with the deprecated stuff by not enabling errors on deprecation warnings unless you really want to make the switch to PyCapsule and break ABI.  If you do, reopen this bug.