SAP / PyRFC

Asynchronous, non-blocking SAP NW RFC SDK bindings for Python
http://sap.github.io/PyRFC
Apache License 2.0
500 stars 132 forks source link

PyRFC versions < 3.1 fail to build from source with Cython 3 #332

Closed bsrdjan closed 11 months ago

bsrdjan commented 1 year ago

After Cython 3.0 released last week, older PyRFC versions fail to pip install on Linux systems and build from source.

To fix the issue upgrade PyRFC to latest version.

PyRFC versions prior to 3.1 require Cython 0.29 for build from source, for example

pip install 'Cython<3'
pip install pyrfc==2.4.1

Recommended solution is using the latest PyRFC version, or Cython < 3, if PyRFC version < 3.1 required.

da-woods commented 1 year ago

The issue is mainly that Cython now allows cdef functions to raise exceptions by default, but you're trying to assign to function pointers that don't accept Python exceptions.

The solution is to add noexcept to any cdef functions that need assigning to an exception-free function pointers.

Please do ping me if you need further help!

bsrdjan commented 1 year ago

Thanks @da-woods! It should work with PyRFC version 3.1, did you try it?

da-woods commented 1 year ago

Ah sorry I didn't read this carefully enough and didn't realise you already had a version that worked with Cython 3.

(I was writing as a Cython maintainer who thought you might need help rather than as someone trying to use PyRFC.)

bsrdjan commented 1 year ago

Thanks @da-woods, I just made the pinned issue comment more clear. I managed to build but I did not manage yet to split the single big Cython source file I currently have. There are few classes in there, like Client and Server, both using common functions. Recommendation how to better structure this Cython monolith would be really helpful.

da-woods commented 1 year ago

Recommendation how to better structure this Cython monolith would be really helpful.

Hopefully that's some use. It doesn't look like there's hugely complicated interdependencies there, so it's mostly just a case of splitting them up into natural Python modules, and using .pxd and cimport to access static typing between the modules.