pycraze wrote: > I would like to ask a question. How do one handle the exception due to > Segmentation fault due to Python ? Our bit operations and arithmetic > manipulations are written in C and to some of our testcases we > experiance Segmentation fault from the python libraries. > >From what you said, I guess you mean that you have written some extensions to Python in C, but that the segmentation fault is generated when you call standard Python library functions.
Most likely your C code has bugs: quite possibly you have messed up reference counting so some objects you use are being freed and then the Python libraries allocate other objects into the same memory. It is very easy to do that especially if you are in the habit of trying to 'borrow' references instead of religiously incrementing/decrementing reference counts everywhere. Try to eliminate the problem down to the smallest reproducable code sample and post that. Another suggestion I would make is to see if you can use ctypes or Pyrex to form the glue between Python and C so that none of the C code you write knows anything about Python. That should eliminate some possible sources for error. -- http://mail.python.org/mailman/listinfo/python-list