• Kirill Smelkov's avatar
    *.pyx += `cython: legacy_implicit_noexcept=True` · 3d751623
    Kirill Smelkov authored
    With Cython 3 the default for functions, that return void and have no
    explicit `except` specification, was switched from `noexcept` to `except *`
    even for functions that are nogil. As the result, when Cython 3
    compiles e.g. wcfs/internal/wcfs_test.pyx, it complains with
    
        def install_sigbus_trap():
            cdef sigaction_t act
            act.sa_sigaction = on_sigbus
                               ^
        ------------------------------------------------------------
    
        wcfs/internal/wcfs_test.pyx:192:23: Cannot assign type 'void (int, siginfo_t *, void *) except * nogil' to 'void (*)(int, siginfo_t *, void *) noexcept'. Exception values are incompatible. Suggest adding 'noexcept' to the type of 'on_sigbus'.
    
    In wendelin.core, similarly to pygolang, there are many nogil functions
    and the perception of those are that they are unrelated to python world
    unless explicitly programmed via e.g. `with gil` sections inside. So a
    `noexcept` specification on such nogil functions could be a bit
    misleading to the reader suggestion that this noexcept is about e.g. C++
    part or panic.
    
    -> Avoid this confusion by activating "legacy" mode of having "no py
    except" by default if that is not specified.
    
    It works on both Cython 3 and Cython 0.29.x because, added directive is
    simply ignored by Cython 0.29.x and the builtin behaviour is already ok.
    
    This patch is based on and mirrors the following pygolang patch:
    kirr/pygolang@b5bb9f7e
    
    /cc @tomo
    /reviewed-by @levin.zimmermann, @jerome
    /reviewed-on !43 + slapos!1863 (comment 260064)
    3d751623