Bug 623855 - Python binding uses PyCObject API (deprecated in Python 2.7)
Summary: Python binding uses PyCObject API (deprecated in Python 2.7)
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 14
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PyCObject
TreeView+ depends on / blocked
 
Reported: 2010-08-13 00:59 UTC by Dave Malcolm
Modified: 2011-12-07 03:49 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-12-07 03:49:54 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dave Malcolm 2010-08-13 00:59:34 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')
and then try to use your module.

Grepping for PyCObject shows usage of the API in many places:
./libvirt-0.8.2/python/typewrappers.c:109:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virDomainPtr",
./libvirt-0.8.2/python/typewrappers.c:124:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virNetworkPtr",
./libvirt-0.8.2/python/typewrappers.c:139:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virInterfacePtr",
./libvirt-0.8.2/python/typewrappers.c:154:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virStoragePoolPtr",
./libvirt-0.8.2/python/typewrappers.c:169:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virStorageVolPtr",
./libvirt-0.8.2/python/typewrappers.c:184:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virConnectPtr",
./libvirt-0.8.2/python/typewrappers.c:199:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virNodeDevicePtr",
./libvirt-0.8.2/python/typewrappers.c:213:    ret = PyCObject_FromVoidPtrAndDesc(node, (char *) "virSecretPtr", NULL);
./libvirt-0.8.2/python/typewrappers.c:226:    ret = PyCObject_FromVoidPtrAndDesc(node, (char *) "virNWFilterPtr", NULL);
./libvirt-0.8.2/python/typewrappers.c:239:    ret = PyCObject_FromVoidPtrAndDesc(node, (char *) "virStreamPtr", NULL);
./libvirt-0.8.2/python/typewrappers.c:253:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virDomainSnapshotPtr",
./libvirt-0.8.2/python/typewrappers.c:269:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virEventHandleCallback",
./libvirt-0.8.2/python/typewrappers.c:285:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virEventTimeoutCallback",
./libvirt-0.8.2/python/typewrappers.c:300:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "virFreeCallback",
./libvirt-0.8.2/python/typewrappers.c:315:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "void*",

To what extent does this leak through to users of the API.

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

Version-Release number of selected component (if applicable):
libvirt-0.8.2-3.fc14.src.rpm

Comment 1 Fedora Admin XMLRPC Client 2011-09-22 17:57:09 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-09-22 18:00:30 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 3 Fedora Admin XMLRPC Client 2011-11-30 19:56:46 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Fedora Admin XMLRPC Client 2011-11-30 19:58:09 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora Admin XMLRPC Client 2011-11-30 20:02:52 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 6 Fedora Admin XMLRPC Client 2011-11-30 20:03:43 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 7 Eric Blake 2011-12-07 03:49:54 UTC
Fixed by this, in F15 or newer.  F14 is near end-of-life now, so it's probably not worth backporting now, so I'm just marking this as closed nextrelease.

commit 4254dfea78e72c109c9e78727a5c5146be372654
Author: Cole Robinson <crobinso>
Date:   Thu Dec 2 12:15:10 2010 -0500

    python: Use PyCapsule API if available
    
    On Fedore 14, virt-manager spews a bunch of warnings to the console:
    
    /usr/lib64/python2.7/site-packages/libvirt.py:1781: PendingDeprecationWarning: The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.the capsule API if available. I've verified this compiles
    fine on older python (2.6 in RHEL6 which doesn't have capsules), and
    virt-manager seems to function fine.


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