Bug 623865

Summary: subversion uses PyCObject API (via SWIG) (deprecated in Python 2.7)
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: subversionAssignee: Joe Orton <jorton>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: atkac, jorton, vanmeeuwen+fedora, ville.skytta
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-02-29 13:55:33 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:22:46 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')
>>> import svn.client
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/svn/client.py", line 19, in <module>
    from libsvn.client import *
  File "/usr/lib64/python2.7/site-packages/libsvn/client.py", line 37, in <module>
    import core
  File "/usr/lib64/python2.7/site-packages/libsvn/core.py", line 7, in <module>
    import _core
PendingDeprecationWarning: The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.
>>> dir(svn.client)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'client'


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

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

It appears to all come from SWIG:
./subversion-1.6.12/subversion/bindings/swig/python/core.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/core.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/core.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/core.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/python/svn_diff.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/svn_diff.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/svn_diff.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/svn_diff.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/python/svn_repos.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/svn_repos.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/svn_repos.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/svn_repos.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/python/svn_delta.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/svn_delta.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/svn_delta.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/svn_delta.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/python/svn_client.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/svn_client.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/svn_client.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/svn_client.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/python/svn_fs.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/svn_fs.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/svn_fs.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/svn_fs.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/python/svn_ra.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/svn_ra.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/svn_ra.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/svn_ra.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/python/svn_wc.c:2260:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/python/svn_wc.c:2325:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/python/svn_wc.c:2348:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/python/svn_wc.c:2353:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/proxy/pyrun.swg:1284:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/proxy/pyrun.swg:1349:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/proxy/pyrun.swg:1372:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/proxy/pyrun.swg:1377:      obj = PyCObject_FromVoidPtr(descriptor, NULL);
./subversion-1.6.12/subversion/bindings/swig/proxy/swig_python_external_runtime.swg:2262:    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
./subversion-1.6.12/subversion/bindings/swig/proxy/swig_python_external_runtime.swg:2327:  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
./subversion-1.6.12/subversion/bindings/swig/proxy/swig_python_external_runtime.swg:2350:    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
./subversion-1.6.12/subversion/bindings/swig/proxy/swig_python_external_runtime.swg:2355:      obj = PyCObject_FromVoidPtr(descriptor, NULL);

Comment 1 Joe Orton 2010-08-13 09:51:36 UTC
Is there a backwards-compatible API which can be used here instead?  It looks like the replacement API is 2.7+ only.

Comment 2 Adam Tkac 2010-08-18 09:00:53 UTC
Does subversion use swig to generate swig/* files in the koji or does it use pregenerated files from upstream?

If it generates files in koji then please look on bug #623854 - this is a bug in the swig and reassign this bugzilla ticket to me and I will rebuild subversion & release update when swig gets fixed.

Comment 3 Joe Orton 2012-02-29 13:55:33 UTC
"Yes" is the answer to comment 2... hence, fixed.

subversion-python-1.6.17-5.fc16.x86_64
python-2.7.2-5.2.fc16.x86_64

Python 2.7.2 (default, Oct 27 2011, 01:40:22) 
[GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import warnings
>>> warnings.filterwarnings('error')
>>> import svn.client
>>>