• Kirill Smelkov's avatar
    *.pyx += `cython: legacy_implicit_noexcept=True` · b5bb9f7e
    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. golang/_golang.pyx, it complains with
    
            void _taskgo_pyexc(void (*f)(void *) nogil, void *arg)      except +topyexc:
                _taskgo(f, arg)
                        ^
        ------------------------------------------------------------
    
        golang/_golang.pyx:596:16: Cannot assign type 'void (*)(void *) except * nogil' to 'void (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of 'f'.
    
    In 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.
    
    /reviewed-by @jerome
    /reviewed-on !37
    b5bb9f7e