Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot assign type 'sighandler_t' to 'void (*)(int) noexcept' #5498

Closed
jwilk opened this issue Jun 22, 2023 · 3 comments
Closed

Cannot assign type 'sighandler_t' to 'void (*)(int) noexcept' #5498

jwilk opened this issue Jun 22, 2023 · 3 comments
Milestone

Comments

@jwilk
Copy link
Contributor

jwilk commented Jun 22, 2023

Since dee8906 ("Keep 'extern' visibility in context of struct/union to properly infer 'noexcept' for function pointer fields (GH-5386)"), this code no longer builds:

#cython: language_level=3

from libc.signal cimport SIG_DFL
from posix.signal cimport sigaction_t

cdef sigaction_t sa
sa.sa_handler = SIG_DFL

The error is:

sa.pyx:7:16: Cannot assign type 'sighandler_t' to 'void (*)(int) noexcept'

Originally reported by @fuzz2ret at jwilk/python-afl#29.
Cc: @matusvalo

@da-woods da-woods added this to the 3.0 milestone Jun 22, 2023
@da-woods
Copy link
Contributor

Thanks - I've just pushed a commit that should fix this

@da-woods
Copy link
Contributor

It's probably worth doing a bit of a sweep of the Cython/Includes folder for other ctypedef functions

@da-woods
Copy link
Contributor

long PyThread_start_new_thread(void (*)(void *), void *) # FIXME: legacy

ctypedef void (*PyOS_sighandler_t)(int)

ctypedef void (*destructor)(PyObject*)

(Few more around there)

int atexit (void (*function) ())

object PyCObject_FromVoidPtr(void* cobj, void (*destr)(void *))

void _Py_PyAtExit(void (*func)(object), object)

Most of those may be OK if there in a cdef extern block, but it might be good to make them explicit anyway. I'll try to do that in the near future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants