explosion / cython-blis

💥 Fast matrix-multiplication as a self-contained Python library – no system dependencies!
Other
218 stars 37 forks source link

Mark Cython functions as `noexcept` explicitly #104

Closed althonos closed 4 months ago

althonos commented 4 months ago

Hi!

Cython has now entered release 3.0 since last year, and one of the big breaking changes is that all functions that are not marked as noexcept are now expected to raise Python exceptions (as with except *); this was done to avoid silencing any potential exception.

This means that the current version of cython-blis, where the functions were not marked as noexcept, compiling with Cython 3.0, would result in the GIL being reacquired on every function call.

Since none of the functions in the cython-blis code should raise exceptions, I just marked all of them noexcept to avoid implicit GIL reacquisition. This is still backward compatible with Cython 0.x.

honnibal commented 4 months ago

Thanks! This makes sense