This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients jcon, kermode, mark.dickinson, ncoghlan, petri.lehtinen, pitrou, pv, rupole, skrah, teoliphant, vstinner
Date 2011-07-05.15:33:18
SpamBayes Score 8.8102636e-11
Marked as misclassified No
Message-id <20110705153112.GA22571@sleipnir.bytereef.org>
In-reply-to <1309877703.3683.29.camel@localhost.localdomain>
Content
Antoine Pitrou <report@bugs.python.org> wrote:
> My issue is that until now sliced memoryviews are independent objects
> and are not affected by the releasing of the original memoryview. With
> this patch, they are, and that's why I'm advocating for a subtler
> approach (which would really mirror the current slicing semantics, and
> wouldn't break compatibility ;)).

I wrote a comment on rietveld (which failed to get mailed again). My plan
is to make the sliced views more independent by copying shape, strides,
and suboffsets unconditionally on construction.

Then it should always be possible to delete views independently.

With respect to releasing, the views are of course still dependent.

> release() is supposed to mean "you can dispose of this memoryview", not
> "you can dispose of any underlying memory area, even if there's some
> sharing that I as an user don't know anything about" (*). By making
> release() affect "related" memoryviews we are exposing an internal
> implementation detail (the PyManagedBuffer sharing) as part of the API.

I thought the rationale for the release() method was to allow sequences like:

b = bytearray()
m1 = memoryview(b)
m1.release() -> must call releasebuffer instantly.
b.resize(10) -> this might fail otherwise if the garbage collection is too slow.

So I think releasebuffer must be called on the original base object,
and only the ManagedBuffer can do that.
History
Date User Action Args
2011-07-05 15:33:19skrahsetrecipients: + skrah, teoliphant, mark.dickinson, ncoghlan, rupole, kermode, pitrou, vstinner, pv, jcon, petri.lehtinen
2011-07-05 15:33:19skrahlinkissue10181 messages
2011-07-05 15:33:18skrahcreate