pyc files problem

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed May 6 00:58:08 EDT 2009


En Wed, 06 May 2009 00:43:25 -0300, Mohamed Lrhazi <lrhazi at 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




More information about the Python-list mailing list