An UCS2-UCS4 incompatibility import failure of a C

2019-07-21 01:30发布

问题:

I'm running into a cython-unicode problem which I hope you can help me with -

I'm trying to compile with cython a python module which works alot with unicode objects.

I'm working on Ubuntu 12.04 32bit, (on a VM on a Win7 64bit host if it has any importance), I'm using Py2.5.4 (can't change that) which I've installed side-by-side with the provided Py2.7.3 (and soft-linked /usr/bin/python to /usr/bin/python2.5), and Cython 19.02 (current one). I'm compiling with no special flags.

Now, as compiling goes seemingly OK, when I open a Py (same 2.5.4) and try to import the resulting. SO file, I get a PyUnicodeUCS2 type error. That is supposed to mean, as I understand, that the SO was compiled on a python configured with UCS4, and imported to python configured with UCS2. But It's the same python I compiled on and imported to.

for compilation I use $ python setup.py bild_ext --inplace where setup.py uses distutlis.extension.Extension and Cython.Distutile.build_ext .

Can someone enlighten me with what's going on and what I can do with it?

I'll be happy to provide more details if I wasn't clear enough.

Thanks a lot..

标签: python cython