Bug 623864 - rpm-python uses PyCObject API (deprecated in Python 2.7)
Summary: rpm-python uses PyCObject API (deprecated in Python 2.7)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 14
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ales Kozumplik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PyCObject
TreeView+ depends on / blocked
 
Reported: 2010-08-13 01:19 UTC by Dave Malcolm
Modified: 2014-09-30 23:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-07 13:14:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


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