[SciPy-dev] Found fix for a long-standing bug in weave.catalog
fperez at colorado.edu
Fri Oct 17 19:38:01 CDT 2003
on and off I've been seeing very strange behavior from weave.inline().
Basically it would rebuild functions which it had already seen before, in a
rather erratic manner. Today I finally dove in to try and fix, and after a
_lot_ of print statements all over weave, I think I got it.
In catalog.py, the add_function_persistent() method NEEDS as its final line:
This closes the shelve catalog object, which guarantees that the changes are
actually committed to disk. From the shelve docs:
Dependent on the implementation, closing a persistent dictionary may
or may not be necessary to flush changes to disk.
It's quite possible that others haven't seen this because they are on
different platforms, or stress weave in different ways. I've actually beeen
using inline() for a long time, and only with one particular library I have,
do I see this problem. But when it hits you, it's extremely annoying, since
you end up paying the compilation time overhead on _every_ function call.
Kind of defeats the purpose of weave :)
Eric, this is the bug I told you about at SciPy'03, which I was seeing on and
off. Quite tricky to track down, but now that I had to understand most of how
weave.inline() & friends work, my hat is off to you. That's one beautiful
piece of code (messy, but amazing :)
It would be great if someone could double check that this is ineed ok (I'm
pretty sure it is) and apply that single line change to the sources. I tested
it against my library, and now it behaves reliably as it should (which it
neveer had before).
More information about the Scipy-dev