python-cython C++ support patch
Masamichi Hosoda
trueroad@trueroad.jp
Sun Jan 31 09:15:55 GMT 2021
>> python38-cython-0.29.21-3 works fine with following test code.
>>
>> ```hello.pyx
>> print('Hello World!')
>> ```
>>
>> ```setup.py
>> from distutils.core import setup
>> from Cython.Build import cythonize
>>
>> setup(
>> ext_modules=cythonize(
>> "hello.pyx",
>> language="c++",
>> )
>> )
>> ```
>>
>> ```test.py
>> import hello
>> ```
>>
>> Here's the result by python38-cython-0.29.21-2 (failed).
>>
>> ```
>> $ python setup.py build_ext --inplace
>> [...snip...]
>> $ python test.py
>> Traceback (most recent call last):
>> File "test.py", line 1, in <module>
>> import hello
>> ImportError: dynamic module does not define module export function (PyInit_hello)
>> ```
>>
>> Here's the result by python38-cython-0.29.21-3 (succeeded).
>>
>> ```
>> $ python setup.py build_ext --inplace
>> [...snip...]
>> $ python test.py
>> Hello World!
>> ```
>>
>> Thanks.
>
> Thanks to you
>
> I still think that the change you proposed should go upstream.
>
> Have you tested your example on a NOT cygwin system ?
>
> Regards
> Marco
Here's the result by Ubuntu 20.04 with python-cython 0.29.21
```
$ lsb_release -d
Description: Ubuntu 20.04.2 LTS
$ pip3 list | grep "Cython"
Cython 0.29.21
$ python3 setup.py build_ext --inplace
[...snip...]
$ python3 test.py
Hello World!
```
The export name is different for the successful and unsuccessful cases.
Here's Cygwin python38-cython-0.29.21-2 (failed).
```
$ nm hello.cpython-38-x86_64-cygwin.dll | grep "PyInit"
000000040b8a22af T _Z12PyInit_hellov
```
Here's Cygwin python38-cython-0.29.21-3 (succeeded).
```
$ nm hello.cpython-38-x86_64-cygwin.dll | grep "PyInit"
000000040b8a22af T PyInit_hello
```
Here's Ubuntu python-cython 0.29.21 (succeeded).
```
$ nm hello.cpython-38-x86_64-linux-gnu.so | grep "PyInit"
00000000000030b7 T PyInit_hello
```
Thanks.
More information about the Cygwin
mailing list