This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tebeka
Recipients tebeka
Date 2007-09-27.17:05:24
SpamBayes Score 0.047327377
Marked as misclassified No
Message-id <1190912724.9.0.418130471784.issue1215@psf.upfronthosting.co.za>
In-reply-to
Content
The following code hangs Python:
#!/usr/bin/env python

import segfault
import signal
from os import _exit
from sys import stdout

def handler(signal, stackframe):
    print "OUCH"
    stdout.flush()
    _exit(1)

if __name__ == "__main__":
    from sys import argv

    signal.signal(signal.SIGSEGV, handler)
    segfault.segfault()

segfault is the following C module:
#include <Python.h>

static PyObject *
segfault(PyObject *self, PyObject *args)
{

    char *c;

    c = 0;
    *c = 'a';

    return Py_BuildValue("");
}

static PyMethodDef Methods[] = {
    { "segfault",  segfault, METH_VARARGS, "will segfault"},
    {NULL, NULL, 0, NULL}        /* Sentinel */
};

PyMODINIT_FUNC
initsegfault(void)
{
    Py_InitModule("segfault", Methods);
}
History
Date User Action Args
2007-09-27 17:05:25tebekasetspambayes_score: 0.0473274 -> 0.047327377
recipients: + tebeka
2007-09-27 17:05:24tebekasetspambayes_score: 0.0473274 -> 0.0473274
messageid: <1190912724.9.0.418130471784.issue1215@psf.upfronthosting.co.za>
2007-09-27 17:05:24tebekalinkissue1215 messages
2007-09-27 17:05:24tebekacreate