harfbuzz / uharfbuzz

A HarfBuzz Python binding
Apache License 2.0
68 stars 25 forks source link

add explicit noexcept to callbacks used by hb C functions #165

Closed anthrotype closed 1 year ago

anthrotype commented 1 year ago

Fixes #164

with this change I can build uharbfbuzz also with the latest Cython 3.0. It continues to build with 0.29 as well.

The 'noexcept' is now required for non-extern cdef functions that are otherwise assumed to propagate exceptions by default in Cython 3 (previously they'd only do if except was used). Some cdef functions in uharfbuzz are passed as callbacks to C hb functions where python exceptions can't be propagated as far as I understand (or can they?), so the fix was to explicitly mark all these with noexcept and then Cython is happy again. I think this is safe and doesn't change the previous behavior since we had not marked these as except before.

See https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html?highlight=noexcept#exception-values-and-noexcept

behdad commented 1 year ago

LGTM.

fredericoschardong commented 1 year ago

Can we have a minor release of uharfbuzz with this fix for Cython 3.0? Other projects such as pyHanko are depending on it.

anthrotype commented 1 year ago

Sure, I just pushed v0.37.1 with the fix, allow a few minutes to let the bots complete the build.