~ubuntu-branches/ubuntu/precise/faulthandler/precise

« back to all changes in this revision

Viewing changes to faulthandler/tests.c

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz, Miriam Ruiz, Jakub Wilk
  • Date: 2011-10-14 00:52:14 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20111014005214-ptrox76xn0x7zlf8
Tags: 2.0-1
[ Miriam Ruiz ]
* New upstream release
* Fixed order of debhelper commands in debian/rules: moved dh_pysupport
  before dh_strip -a
* Upgraded Standards-Version from 3.9.1 to 3.9.2
* Added targets build-arch and build-indep to debian/rules
* Changed homepage in debian/control to
  https://github.com/haypo/faulthandler/wiki/

[ Jakub Wilk ]
* Add Vcs-* fields.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "faulthandler.h"
2
 
 
3
 
PyObject *
4
 
faulthandler_sigsegv(PyObject *self, PyObject *args)
5
 
{
6
 
    int *x = NULL, y;
7
 
    int release_gil = 0;
8
 
    if (!PyArg_ParseTuple(args, "|i", &release_gil))
9
 
        return NULL;
10
 
    if (release_gil) {
11
 
        Py_BEGIN_ALLOW_THREADS
12
 
        y = *x;
13
 
        Py_END_ALLOW_THREADS
14
 
    } else
15
 
        y = *x;
16
 
    return PyLong_FromLong(y);
17
 
 
18
 
}
19
 
 
20
 
PyObject *
21
 
faulthandler_sigfpe(PyObject *self, PyObject *args)
22
 
{
23
 
    int x = 1, y = 0, z;
24
 
    z = x / y;
25
 
    return PyLong_FromLong(z);
26
 
}
27
 
 
28
 
#ifdef SIGBUS
29
 
PyObject *
30
 
faulthandler_sigbus(PyObject *self, PyObject *args)
31
 
{
32
 
    while(1)
33
 
        raise(SIGBUS);
34
 
    Py_RETURN_NONE;
35
 
}
36
 
#endif
37
 
 
38
 
#ifdef SIGILL
39
 
PyObject *
40
 
faulthandler_sigill(PyObject *self, PyObject *args)
41
 
{
42
 
    while(1)
43
 
        raise(SIGILL);
44
 
    Py_RETURN_NONE;
45
 
}
46
 
#endif
47