[python-crypto] porting of m2crypto on python 3

Antoine Pitrou solipsis at pitrou.net
Sun Jan 20 00:10:06 CET 2013


Le samedi 19 janvier 2013 à 20:28 +0100, Matej Cepl a écrit :
> matej at wycliff: M2Crypto (python3 %)$ python3
> Python 3.3.0 (default, Oct  2 2012, 09:27:11)
> [GCC 4.7.2 20120921 (Red Hat 4.7.2-2)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import __m2crypto
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: ./__m2crypto.cpython-33m.so: undefined symbol: PyFile_Check
> >>>
> 
> That's probably problem with SWIG, isn't (I don't have PyFile_Check
> anywhere in my source files)? Does anybody have any idea how to work
> around it?

I'm not sure SWIG is Python 3-enabled.
In any case, PyFile_Check doesn't exist in Python 3. The reason is that
Python 2 file objects, which were wrappers around a FILE pointer, don't
exist anymore. Instead, Python 3 I/O objects implement their own
buffering layer around a file descriptor.

It means that if m2crypto relies on FILE pointer-accepting OpenSSL
functions, some amount of rewriting is needed.

Regards

Antoine.




More information about the python-crypto mailing list