Re: [cgkit-user] segfault help?
Brought to you by:
mbaas
|
From: Matthias B. <mat...@gm...> - 2012-05-02 22:16:33
|
On 01.05.12 21:57, Alejandro Aguilera Martínez wrote: > $ python tst.py > Traceback (most recent call last): > File "tst.py", line 7, in <module> > print (testmod.err(-1)) > RuntimeError: Test error > > I guess this was expected to throw a seg fault and it didn't. Just after > that I ran "from cgkit.all import *" in a python interpreter and it > threw a seg fault. What should I do now? Well, looks like just throwing an exception is not the problem, there must be some other condition to trigger the segfault and we still need to find what that is. We could now reduce the cgkit module step by step until we reach this very simple example. While doing so, there must be a point where we switch from a module that does not work (current cgkit) to a module that does work (the simple example). When we have found that transition point we might have found the problematic piece of code. But before doing that, let's change the example a little bit so that it actually matches what's done in cgkit. I have attached an updated wrapper.cpp. This version throws a custom exception and registers an exception translator which is also what's done in cgkit. This means instead of receiving a RuntimeError in Python, you should instead see a ValueError. If that example still works, you could try and remove stuff from wrappers/py_wrapper.cpp (which is the main wrapper file). The main function is the one at the bottom which begins with BOOST_PYTHON_MODULE(_core). Initially, you could comment out everything in that function except for the call to class_vec3(). That means, the generated module will only contain the vec3 class. If that results in a module that does not segfault anymore, you could try and add stuff back in step by step and see when the segfault comes back. Cheers, - Matthias - |