Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-20 Thread Frithiof Andreas Jensen
"Christian Stapfer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Check your program for _uninitialized_variables_. good point. > (Just a guess: but what other side-effect than > changing the values of uninitialized variables > - and the program's timing, of course - might > the

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-20 Thread Frithiof Andreas Jensen
"Lil" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I already double checked my C code. It runs perfectly fine in C without > any errors. Errr - It runs perfectly fine without *announcing* any errors (while gleefully urinating all over its memory space). The programming model for

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Christian Stapfer
"Lil" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I already double checked my C code. It runs perfectly fine in C without > any errors. So in my python program, I added a pdb.set_trace() > and step through the program and it did not dump. But when i took out > the tracing, the cor

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Mike Meyer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > Lil wrote:' > >>I already double checked my C code. It runs perfectly fine in C without >> any errors. So in my python program, I added a pdb.set_trace() >> and step through the program and it did not dump. But when i took out >> the tracing, the core

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Fredrik Lundh
Lil wrote:' >I already double checked my C code. It runs perfectly fine in C without > any errors. So in my python program, I added a pdb.set_trace() > and step through the program and it did not dump. But when i took out > the tracing, the core dump came back. "sigh" so triple-check it. if your

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Lil
I already double checked my C code. It runs perfectly fine in C without any errors. So in my python program, I added a pdb.set_trace() and step through the program and it did not dump. But when i took out the tracing, the core dump came back. "sigh" -- http://mail.python.org/mailman/listinfo/pyth

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Fredrik Lundh
"Lil" <[EMAIL PROTECTED]> wrote: > It's in the C code mainly because the buffer is an input to the > driver. The driver takes a char* as input and I didn't want to pass a > char* from python -> swig -> C since swig has memory leaks passing > pointers. > Do you think this is a Python issue or

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Lil
Hi Larry, It's in the C code mainly because the buffer is an input to the driver. The driver takes a char* as input and I didn't want to pass a char* from python -> swig -> C since swig has memory leaks passing pointers. Do you think this is a Python issue or a Red Hat issue? I'm going to try

Re: Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Larry Bates
Question: Why not just use Python to read the file? f=open(filename, 'rb') fcontents=f.read() If you need to manipulate what is in fcontents you can use struct module and/or slicing. Larry Bates Lil wrote: > Hi Everyone! I've been trying to figure out this weird bug in my > program. I have a p

Help! Python either hangs or core dumps when calling C malloc

2005-09-08 Thread Lil
Hi Everyone! I've been trying to figure out this weird bug in my program. I have a python program that calls a C function that reads in a binary file into a buffer. In the C program, buffer is allocated by calling malloc. The C program runs perfectly fine but when I use python to call the C functio