Skip to content

Commit 59a0397

Browse files
committed
Inline _Py_RestoreSignals() from CPython
private _Py_RestoreSignals() has been moved to CPython internals as of Python 3.13 See: python/cpython#106400
1 parent 6c770dc commit 59a0397

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

uvloop/includes/compat.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,20 @@ int Context_Exit(PyObject *ctx) {
8383
}
8484

8585
#endif
86+
87+
/* inlined from cpython/Modules/signalmodule.c
88+
private _Py_RestoreSignals has been moved to CPython internals as of Python 3.13
89+
https://github.com/python/cpython/pull/106400 */
90+
void
91+
_Py_RestoreSignals(void)
92+
{
93+
#ifdef SIGPIPE
94+
PyOS_setsig(SIGPIPE, SIG_DFL);
95+
#endif
96+
#ifdef SIGXFZ
97+
PyOS_setsig(SIGXFZ, SIG_DFL);
98+
#endif
99+
#ifdef SIGXFSZ
100+
PyOS_setsig(SIGXFSZ, SIG_DFL);
101+
#endif
102+
}

uvloop/includes/python.pxd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ cdef extern from "Python.h":
1111
object PyUnicode_EncodeFSDefault(object)
1212
void PyErr_SetInterrupt() nogil
1313

14-
void _Py_RestoreSignals()
15-
1614
object PyMemoryView_FromMemory(char *mem, ssize_t size, int flags)
1715
object PyMemoryView_FromObject(object obj)
1816
int PyMemoryView_Check(object obj)
@@ -29,3 +27,5 @@ cdef extern from "includes/compat.h":
2927
void PyOS_BeforeFork()
3028
void PyOS_AfterFork_Parent()
3129
void PyOS_AfterFork_Child()
30+
31+
void _Py_RestoreSignals()

0 commit comments

Comments
 (0)