PQueue and Python 2.5

Gabriel Genellina gagsl-py at yahoo.com.ar
Fri Jan 19 11:45:44 EST 2007


"Berteun Damman" <berteun at gmail.com> escribió en el mensaje 
news:1169216890.617239.209170 at 51g2000cwl.googlegroups.com...

> Recently I was looking for a Priority Queue module, and I've found
> Pqueue by Andrew Snare [1].
That appears to be rather ancient, from 1999. Is it a pure Python 
implementation or has some C code too?

Python got in 2.3 a heapq module in its standard library; I think it is what 
you want, no need for an additional module.

> *** glibc detected *** free(): invalid pointer: 0x00002ad7b5720288 ***
> Abort
>
> And on my PowerBook:
> python2.5(8124) malloc: ***  Deallocation of a pointer not malloced:
> 0x3b4218; This could be a double free(), or free() called with the
> middle of an allocated block;
>
> A memory fault can also be immediately triggered by apply 'del' to a
> PQueue-instance. As said, with Python 2.4 it seems to perform without
> problems.

Ah! then I bet:
- There is some C code involved.
- It carelessly mixes PyMem_Malloc with PyObject_Free or similar as 
described in
http://docs.python.org/whatsnew/ports.html

So do yourself a favor and forget about such old piece of code...

-- 
Gabriel Genellina 





More information about the Python-list mailing list