segmentation fault while using ctypes

Diez B. Roggisch deets at nospam.web.de
Tue Apr 14 18:56:30 EDT 2009


sanket schrieb:
> Hello All,
> 
> I am dealing with this weird bug.
> I have a function in C and I have written python bindings for it using
> ctypes.
> 
> I can call this function for couple of times and then suddenly it
> gives me seg fault.
> But I can call same function from a C code for any number of times.
> 
> I cannot get what's going on.

Try debugging it. While a python debug-build might help, I have been 
getting good results with a simple

# gdb python
$ set args testscript.py
$ run


then when the segfaults hit, get a backtrace. You can also of course set 
a berakpoint to the function in question.

Diez



More information about the Python-list mailing list