Bug 623858 - pycairo uses PyCObject API (deprecated in Python 2.7)
pycairo uses PyCObject API (deprecated in Python 2.7)
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: pycairo (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: John (J5) Palmieri
Fedora Extras Quality Assurance
:
Depends On:
Blocks: PyCObject
  Show dependency treegraph
 
Reported: 2010-08-12 21:07 EDT by Dave Malcolm
Modified: 2013-03-13 00:51 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-08-18 16:38:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dave Malcolm 2010-08-12 21:07:26 EDT
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 02:51:54 EDT
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 16:05:52 EDT
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 16:38:08 EDT
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 16:40:53 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.