seg. fault with ext. module
Gorny
gorny at hobbiton.org
Sat Aug 25 05:20:30 EDT 2001
Hi,
-----code------
#include <Python.h>
static PyObject * makesock(PyObject *self, PyObject *args);
static PyMethodDef gforce_methods[] = {
{"makesock", makesock, METH_VARARGS},
{NULL, NULL}
};
static PyObject * makesock(PyObject *self, PyObject *args)
{
printf("Making socket...\n");
return Py_None;
}
/* Initialization function for the module */
DL_EXPORT(void) initgforce(void)
{
(void)Py_InitModule("gforce", gforce_methods);
}
-----eof-----
>>> import gforce
>>> gforce.makesock()
Making socket...
>>> Ctrl-D
Segmentation fault
[gorny at darkstar ~/gforce]$
How do I prevent this. If i import other modules and close the python-shell
it'll not end with a segmentation fault, only if it's my module.. Do i have
to make an extra function in it, which `de-inits` the module..??
Greets,
Gorny
--
"When I was a little kid, I had this dream where a snake would rule and
dominate
the entire world (actually, I guess that a penguin was also part of the
dream...
but never mind)" -- Python Develper's Handbook, Andre Lessa
http://gorny.cjb.net
More information about the Python-list
mailing list