rpm-python uses PyCObject API (deprecated in Python 2.7)

Bug #633649 reported by Jeff Johnson
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description


Tags: fedora python
Revision history for this message
In , Dave (dave-redhat-bugs) wrote :

Description of problem:
Python 2.7 deprecated the PyCObject API in favor of a new "capsule" API.

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):

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..

Revision history for this message
In , Panu (panu-redhat-bugs) wrote :

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...

Jeff Johnson (n3npq)
tags: added: fedora python
Changed in rpm:
importance: Undecided → Wishlist
Revision history for this message
In , Ales (ales-redhat-bugs) wrote :
Revision history for this message
In , Ales (ales-redhat-bugs) wrote :

Fixed on the rpm master branch by c87ad03260fea33da6d64f65709981b06d4e135a.

Revision history for this message
In , Panu (panu-redhat-bugs) wrote :

Fixed in rawhide / Fedora >= 18, F14 is long EOL by now anyway.

Changed in fedora:
importance: Unknown → Medium
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.