[Pkg-exppsy-maintainers] Bug in NiftiDataset possibly fixed

Per B. Sederberg persed at princeton.edu
Tue Feb 12 20:50:08 UTC 2008


Hi Everybody:

I think I found and fixed the bug in NiftiDataset, but we need to
check whether this is a more prevalent problem throughout the entire
pymvpa project.  Here's my commit message:

I think there is a larger issue with a possibly flawed coding practice
used throughout pymvpa.
Specifically, there loads of times where a default value of a keyword
argument is set to be either {} or
[].  I think the proper way to deal with this is to have the value set
to None and then manually set it
in the code to the empty dict or list.  Otherwise, the default values
for a method are only evaluated
once, which means that you are reusing the reference to the empty
dict/list, which I think was causing
all the issues with NiftiDataset and could be causing other memory
issues, as well.

So, as of now, all the tests pass when I changed out the dsattr to
default to None and not {}.  I think
we should really verify whether it's ok to use {} and [] as default
kwarg values and if not, these should
be changed throughout the entire package.

It could be that this is related to a big garbage collection bug (i.e.
lack of garbage collection) that I was seeing last month.  Essentially
I had to quit out of the ipython interpreter if I wanted to load a new
dataset because it would not overwrite the old one.

Let me know what ya'll think...

Latro,
P



More information about the Pkg-exppsy-maintainers mailing list