[Pythonmac-SIG] Restrictions on what you can do in a Python module?

Jack Jansen Jack.Jansen at cwi.nl
Fri Aug 29 01:15:37 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.

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(&params, 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




More information about the Pythonmac-SIG mailing list