[Pythonmac-SIG] Restrictions on what you can do in a Python
module?
Robb Brown
brownr at ucalgary.ca
Fri Aug 29 11:41:20 EDT 2003
>> On woensdag 27 augustus 2003, at 20:12PM, Robb Brown wrote:
>>> Anyway, here's the code. The crash is on line 104, where all the
>>> setup is finished and I actually ask dcmtk to connect.
>>
>> That line looks harmless enough.
>
> You'd think.... How would one go about using a debugger on a Python
> module (remember, the code does not crash when not compiled as a
> module). I've been debugging with printf's and it was a trip down the
> rabbit hole. That line winds through a couple of functions to a
> finite state machine that uses a doubly linked list. The actual error
> seems to be when one of the nodes in this list is deleted. I don't
> know why this would be different in and out of a module. My next step
> is to try running it as an executable to see how it SHOULD work.
>
>
>> A few ideas:
>> - Try building with -O0. The crash may actually be on a different line
>> if you've compiled with optimizing on.
>> - How are you compiling and linking? If you're using distutils you
>> should be
>> fine, otherwise please send the Makefile. Actually: don't send the
>> Makefile,
>> but use distutils and see if the problem goes away;-)
>> - Try building the working C++ version with the exact same libraries
>> and defines and other compiler flags that are used for compile/link
>> of the Python module. See if it still works.
>>
>> Finally, you probably know what you're doing, but the treatment
>> of some objects strikes me as funny. For instance, the "params"
>> structure appears to be allocated by your library (because you
>> initialize
>> it with "ASC_createAssociationParameters(¶ms, ASC_DEFAULTMAXPDU)",
>> but there isn't a corresponding ASC_freeAssociationParameters() or
>> something
>> similar. This looks suspicious. You could examine the values of the
>> various pointers in gdb to make sure that they make sense. Or, even
>> better,
>> initialize them all to NULL at function entry, so you know you'll get
>> a segmentation
>> violation if there's a misunderstanding about the API.
>> --
>> Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
>> If I can't dance I don't want to be part of your revolution -- Emma
>> Goldman
>>
>>
_____________________________
Robb Brown
Seaman Family MR Center
Calgary, AB
More information about the Pythonmac-SIG
mailing list