[ZODB-Dev] Odd output from checkbtrees.py

Paul Winkler pw_lists at slinkp.com
Wed Sep 3 01:13:04 EDT 2003


On Tue, Sep 02, 2003 at 09:20:04PM -0400, Tim Peters wrote:
> [Paul Winkler]
> > There is a problem, but it's not what I said it was. It's obj.items that
> > is the problem because it *can* be acquired.
> 
> It makes sense that obj.items but not obj.__dict__.items can be acquired.  I
> still don't grasp why that's "a problem", though.


It's only a problem in the absence of a check to see if we've
iterated over the current object already. Without such a check,
if foo.bar.items() is actually foo.items(), and foo.items() returns
a sequence that contains bar, then the next recursion will call
foo.bar.bar.items(), and the next will call foo.bar.bar.bar.items(),
ad infinitum.  The actual output I experienced was a little more 
interesting because foo.items() actually returns (bar, boff, blurg) 
so it was trying every possible combination of foo.bar.boff.blurg, 
foo.boff.blurg.bar, etc. with no limit to the length of the sequence. 

(From the interesting-for-no-particular-reason department:
for reasons I don't understand, the combinations appeared in the 
output in discrete clumps of length N ** M, where N = len(foo.items())
and M is an increment, but there would generally be a long 
section of unrelated stuff in between e.g.  the clump of 
length N ** 4 and the clump of length N ** 5.)

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's FIVE DOLLAR BUTCHER!
(random hero from isometric.spaceninja.com)



More information about the ZODB-Dev mailing list