Debian Codegraph @

pypy/module/cpyext/test/test_pysignals.py

raw symbols SCIP
1 from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase
2
3 class AppTestBufferObject(AppTestCpythonExtensionBase):
4 def test_signals(self):
5 module = self.import_extension('foo', [
6 ("test_signals", "METH_NOARGS",
7 """
8 PyOS_sighandler_t handler = SIG_IGN;
9 PyOS_sighandler_t oldhandler;
10 int result = 0;
11
12 oldhandler = PyOS_getsig(SIGFPE);
13
14 handler = PyOS_setsig(SIGFPE, SIG_IGN);
15
16 if( oldhandler != handler )
17 result += 1;
18
19 handler = PyOS_setsig(SIGFPE, oldhandler);
20
21 if( handler != SIG_IGN )
22 result += 2;
23
24 return PyLong_FromLong(result);
25 """),
26 ], prologue = """
27 #include <signal.h>
28 """)
29 res = module.test_signals()
30 assert res == 0