Bug 623859

Summary: pyOpenSSL uses PyCObject API (deprecated in Python 2.7)
Product: [Fedora] Fedora Reporter: Dave Malcolm <dmalcolm>
Component: pyOpenSSLAssignee: Tomas Mraz <tmraz>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: paul
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: 2011-06-21 07:24:19 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:11:08 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 OpenSSL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/OpenSSL/__init__.py", line 11, in <module>
    import rand, crypto, SSL, tsafe
PendingDeprecationWarning: The CObject type is marked Pending Deprecation in Python 2.7.  Please use capsule objects instead.
>>> dir(OpenSSL)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'OpenSSL' is not defined

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


Version-Release number of selected component (if applicable):
pyOpenSSL-0.9-2.fc14.src.rpm

Grepping the source tree shows these uses of the API:
./pyOpenSSL-0.9/src/crypto/crypto.c:807:    c_api_object = PyCObject_FromVoidPtr((void *)crypto_API, NULL);
./pyOpenSSL-0.9/src/crypto/crypto.h:112:    if (PyCObject_Check(crypto_api_object)) { \
./pyOpenSSL-0.9/src/crypto/crypto.h:113:      crypto_API = (void **)PyCObject_AsVoidPtr(crypto_api_object); \
./pyOpenSSL-0.9/src/ssl/ssl.c:121:    ssl_api_object = PyCObject_FromVoidPtr((void *)ssl_API, NULL);
./pyOpenSSL-0.9/src/ssl/ssl.h:73:    if (PyCObject_Check(c_api_object)) { \
./pyOpenSSL-0.9/src/ssl/ssl.h:74:      ssl_API = (void **)PyCObject_AsVoidPtr(c_api_object); \

Some of these are within header files, which could complicate things further.

Comment 1 Fedora Admin XMLRPC Client 2011-06-20 22:34:22 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Tomas Mraz 2011-06-21 07:24:19 UTC
This must be fixed upstream.