[Python-Dev] PEP 296 - The Buffer Problem

Thomas Heller thomas.heller@ion-tof.com
Tue, 23 Jul 2002 20:04:00 +0200


> > 
> > Why is this? Wouldn't it be sufficient if views keep references
> > to the 'viewed' byte object?
> > 
> 
> They do, but the referenced "inner-thing" needs it's own reference count to
> know how many "bytes-views" are sharing it.  When a bytes-view gets cleaned
> up, it decrefs the reference count of the inner-thing it is referring to,
> and if the reference count goes to zero, the bytes-view calls the
> destructor for the inner-thing.
> 
Hm, I thought the 'inner-thing' is a python object (with it's own
refcount) itself. Isn't the 'inner-thing' the bytes object owning
the allocated memory? And the 'outer-things' (the views) simply
viewing slices of this memory?

Thomas