Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r90584:25aaba6da424
Date: 2017-03-07 13:49 +0100
http://bitbucket.org/pypy/pypy/changeset/25aaba6da424/

Log:    _Py_RestoreSignals(). Hard to test

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -597,6 +597,7 @@
     'PyImport_ImportModuleLevel',
 
     'PyOS_getsig', 'PyOS_setsig',
+    '_Py_RestoreSignals',
     'PyThread_get_thread_ident', 'PyThread_allocate_lock', 
'PyThread_free_lock',
     'PyThread_acquire_lock', 'PyThread_release_lock',
     'PyThread_create_key', 'PyThread_delete_key', 'PyThread_set_key_value',
diff --git a/pypy/module/cpyext/include/pylifecycle.h 
b/pypy/module/cpyext/include/pylifecycle.h
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/include/pylifecycle.h
@@ -0,0 +1,17 @@
+#ifndef Py_PYLIFECYCLE_H
+#define Py_PYLIFECYCLE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _Py_RestoreSignals(void);
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_PYLIFECYCLE_H */
diff --git a/pypy/module/cpyext/src/pylifecycle.c 
b/pypy/module/cpyext/src/pylifecycle.c
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/src/pylifecycle.c
@@ -0,0 +1,15 @@
+#include "Python.h"
+
+void
+_Py_RestoreSignals(void)
+{
+#ifdef SIGPIPE
+    PyOS_setsig(SIGPIPE, SIG_DFL);
+#endif
+#ifdef SIGXFZ
+    PyOS_setsig(SIGXFZ, SIG_DFL);
+#endif
+#ifdef SIGXFSZ
+    PyOS_setsig(SIGXFSZ, SIG_DFL);
+#endif
+}
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to