Bug 623856

Summary: libxml2 uses PyCObject API (deprecated in Python 2.7)
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: libxml2Assignee: Daniel Veillard <veillard>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: veillard
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-16 21:18:47 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:01:39 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 through the prepped sources shows the following usage of the API:
./libxml2-2.7.7/python/types.c:166:        PyCObject_FromVoidPtrAndDesc((void *) doc, (char *) "xmlDocPtr",
./libxml2-2.7.7/python/types.c:184:        PyCObject_FromVoidPtrAndDesc((void *) node, (char *) "xmlNodePtr",
 ./libxml2-2.7.7/python/types.c:202:        PyCObject_FromVoidPtrAndDesc((void *) uri, (char *) "xmlURIPtr",
./libxml2-2.7.7/python/types.c:220:        PyCObject_FromVoidPtrAndDesc((void *) ns, (char *) "xmlNsPtr",
./libxml2-2.7.7/python/types.c:238:        PyCObject_FromVoidPtrAndDesc((void *) attr, (char *) "xmlAttrPtr",
./libxml2-2.7.7/python/types.c:256:        PyCObject_FromVoidPtrAndDesc((void *) attr,
./libxml2-2.7.7/python/types.c:274:        PyCObject_FromVoidPtrAndDesc((void *) elem,
./libxml2-2.7.7/python/types.c:292:        PyCObject_FromVoidPtrAndDesc((void *) ctxt,
./libxml2-2.7.7/python/types.c:309:    ret = PyCObject_FromVoidPtrAndDesc((void *) ctxt,
./libxml2-2.7.7/python/types.c:329:        PyCObject_FromVoidPtrAndDesc((void *) ctxt,
./libxml2-2.7.7/python/types.c:404:			    PyCObject_FromVoidPtrAndDesc((void *) node,
./libxml2-2.7.7/python/types.c:588:            if (PyCObject_Check(node)) {
./libxml2-2.7.7/python/types.c:643:		PyCObject_FromVoidPtrAndDesc((void *) valid,
./libxml2-2.7.7/python/types.c:662:        PyCObject_FromVoidPtrAndDesc((void *) catal,
./libxml2-2.7.7/python/types.c:680:        PyCObject_FromVoidPtrAndDesc((void *) buffer,
./libxml2-2.7.7/python/types.c:698:        PyCObject_FromVoidPtrAndDesc((void *) buffer,
./libxml2-2.7.7/python/types.c:717:        PyCObject_FromVoidPtrAndDesc((void *) regexp,
./libxml2-2.7.7/python/types.c:737:        PyCObject_FromVoidPtrAndDesc((void *) reader,
./libxml2-2.7.7/python/types.c:755:        PyCObject_FromVoidPtrAndDesc((void *) locator,
./libxml2-2.7.7/python/types.c:775:        PyCObject_FromVoidPtrAndDesc((void *) ctxt,
./libxml2-2.7.7/python/types.c:793:        PyCObject_FromVoidPtrAndDesc((void *) ctxt,
./libxml2-2.7.7/python/types.c:810:        PyCObject_FromVoidPtrAndDesc((void *) valid,
./libxml2-2.7.7/python/types.c:828:		PyCObject_FromVoidPtrAndDesc((void *) ctxt,
./libxml2-2.7.7/python/types.c:846:		PyCObject_FromVoidPtrAndDesc((void *) ctxt,
./libxml2-2.7.7/python/types.c:866:		PyCObject_FromVoidPtrAndDesc((void *) valid,
./libxml2-2.7.7/python/types.c:886:        PyCObject_FromVoidPtrAndDesc((void *) error,
./libxml2-2.7.7/python/libxml.c:2036:    if (!PyCObject_Check(pyobj_reader)) {
./libxml2-2.7.7/python/libxml.c:3602:    str = PyCObject_GetDesc(obj);
./libxml2-2.7.7/python/generator.py:1000:                    classes.write("'PyCObject':\n")
./libxml2-2.7.7/python/generator.py:1002:                    classes.write("'%s needs a PyCObject argument'\n" % \
./libxml2-2.7.7/ChangeLog:6455:	  PyCObject.

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):
libxml2-2.7.7-2.fc14.src.rpm

Comment 1 Fedora End Of Life 2012-08-16 21:18:50 UTC
This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping