Bug 623864

Summary: rpm-python uses PyCObject API (deprecated in Python 2.7)
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: rpmAssignee: Ales Kozumplik <akozumpl>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: akozumpl, ffesti, jnovy, jzeleny, pmatilai
Target Milestone: ---Keywords: Upstream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-07 13:14:45 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:19:40 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 the module (sorry; I don't have a more specific reproducer for this package yet)

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


Version-Release number of selected component (if applicable):
rpm-4.8.1-4.fc14.src.rpm

Grepping prepped source tree shows these uses:
./rpm-4.8.1/python/header-py.c:371:    } else if (PyCObject_Check(obj)) {
./rpm-4.8.1/python/header-py.c:372:	h = PyCObject_AsVoidPtr(obj);
./rpm-4.8.1/python/spec-py.c:37:    PyObject *ptr = PyCObject_FromVoidPtr(h, NULL);
./rpm-4.8.1/ChangeLog:753:    Permit header object generation from PyCObjects
./rpm-4.8.1/ChangeLog:24215:    OTOH we need to call PyCObject_FromVoidPtr() with non-const cast..

Comment 1 Panu Matilainen 2010-08-13 08:37:10 UTC
Hmph. I'm not comfortable with having (upstream) rpm require a python version with incompatibilities which was only just released a month ago. Based on a quick look, it'd seem that the PyCapsule API is sufficiently similar to PyCObject API that it can be handled with a few macros for python < 2.7, but I'll need to take a closer look...

Comment 2 Ales Kozumplik 2011-11-16 13:08:23 UTC
I proposed a fix at http://lists.rpm.org/pipermail/rpm-maint/2011-November/003124.html

Comment 3 Ales Kozumplik 2011-11-18 10:01:16 UTC
Fixed on the rpm master branch by c87ad03260fea33da6d64f65709981b06d4e135a.

Comment 4 Panu Matilainen 2012-05-07 13:14:45 UTC
Fixed in rawhide / Fedora >= 18, F14 is long EOL by now anyway.