[New-bugs-announce] [issue1215] Python hang when catching a segfault
Miki Tebeka
report at bugs.python.org
Thu Sep 27 19:05:24 CEST 2007
New submission from Miki Tebeka:
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);
}
----------
components: Interpreter Core
messages: 56169
nosy: tebeka
severity: normal
status: open
title: Python hang when catching a segfault
type: crash
versions: Python 2.5
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1215>
__________________________________
More information about the New-bugs-announce
mailing list