gh-133465: Efficient signal checks with detached thread state. by zackw · Pull Request #135358 · python/cpython · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions Doc/c-api/exceptions.rst
2 changes: 2 additions & 0 deletions Include/pyerrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);

/* In signalmodule.c */
PyAPI_FUNC(int) PyErr_CheckSignals(void);
PyAPI_FUNC(int) PyErr_CheckSignalsDetached(PyThreadState *state);
PyAPI_FUNC(int) PyErr_AreSignalsPending(PyThreadState *state);
PyAPI_FUNC(void) PyErr_SetInterrupt(void);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
PyAPI_FUNC(int) PyErr_SetInterruptEx(int signum);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
New functions :c:func:`PyErr_CheckSignalsDetached` and
:c:func:`PyErr_AreSignalsPending` for responding to signals
from within C extension modules that detach the thread state.
Patch by Zack Weinberg.
69 changes: 55 additions & 14 deletions Modules/signalmodule.c