En Wed, 06 May 2009 00:43:25 -0300, Mohamed Lrhazi <lrh...@gmail.com> escribió:

My code sends a pointer to a Python function to a C library, using
ctypes module. When my program restarts, after a crash or normal
exit... it cannot start again without sigfaulting

Do you mean that, if you delete the .pyc files your program runs properly, but if you keep the .pyc files your program crashes?
That's very strange...

What is the proper way around this problem? other than adding code to
delete the cache files?

There is no "proper way around" the problem; it should not exist in the first place!

Have you read the note at the end of the "Callback" section in the ctypes documentation?
"""Important note for callback functions:

Make sure you keep references to CFUNCTYPE objects as long as they are used from C code. ctypes doesn't, and if you don't, they may be garbage collected, crashing your program when a callback is made."""

There is a ctypes-specific list: https://lists.sourceforge.net/lists/listinfo/ctypes-users

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to