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

Robb Brown brownr at ucalgary.ca
Wed Aug 27 12:53:07 EDT 2003


Hm.  Strange that the same code works from C but not Python... dcmtk 
does apparently use
some threads.  Do I have to do something specific to make C threads 
work with Python?
Unfortunately, any threading is done within the toolkit - which I'd 
rather not modify too much.
Is there something I put in the wrapper?

Thanks,

Robb

Bob Ippolito <bob at redivi.com> said:

> On Wednesday, Aug 27, 2003, at 11:40 America/New_York, Robb Brown 
> wrote:
>
>> I'm trying to write wrappers for dcmtk (a toolkit for the medical
>> imaging DICOM standard).  At the moment I have three functions, to
>> open an association (basically a network connection), close it, and
>> send an echo request (like a ping).  A test program written entirely
>> in C works fine but when compiled as a module and called from Python I
>> get an illegal instruction when the dcmtk function to actually open
>> the association is called.  I believe this function is simply opening
>> a socket, connecting to a server and negotiating what flavour of the
>> protocol to use.
>>
>> Are there things that simply can't be done in a Python module?  What
>> exactly is an illegal instruction?
>
> Illegal instruction is a CPU level exception.  What it means is that
> the CPU tried to execute invalid opcode.  It has nothing to do with
> security or Python.  Generally what it means that some branch
> instruction told the CPU to go somewhere that wasn't code at all, which
> can happen if you have a corrupted stack or function pointer.
>
> In any case, this is almost certainly a bug in your wrapper.  If dcmtk
> uses threads you might not be doing the right thing with thread states
> from Python, otherwise you've just got some bad C code somewhere.  If
> you post the code you have, someone might look at it.
>
> -bob
>
>
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig
>

_____________________________
Robb Brown
Seaman Family MR Center
Calgary, AB




More information about the Pythonmac-SIG mailing list