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 Arfrever, Dag.Sverre.Seljebotn, belopolsky, christian.heimes, georg.brandl, loewis, mark.dickinson, meador.inge, ncoghlan, pitrou, scoder, skrah, vstinner
Date 2012-08-31.08:26:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20120831082648.GA27982@sleipnir.bytereef.org>
In-reply-to <1346383891.67.0.981628251748.issue15814@psf.upfronthosting.co.za>
Content
Dag Sverre Seljebotn <report@bugs.python.org> wrote:
> It is perfectly possible for an object to export memory in a read-only
> way that may still change. Another object may have a writeable view:
> 
> x = obj.readonly_view
> y = obj.writable_view
> obj.move_to_next_image() # changes memory under x, y

PEP-3118 always means different things to different people. :)

Your distinction between constant, readonly, writable is one way to
interpret things. But looking at the use in the Python source tree,
readonly does mean immutable.

Unfortunately the PEP doesn't specify readonly: Is it the same as
"mount a partition readonly", "readonly CD" or O_RDONLY?

Also, existing practice was that in response to a PyBUF_FULL_RO request
the exporter was free to hand out a writable buffer!

This is now documented and subverts reliable tagging for consumers:

http://docs.python.org/dev/c-api/buffer.html#readonly-format

If any of this is a major inconvenience to NumPy or other users of the
buffer API, perhaps you could open a separate issue.

> (FWIW, not sure how relevant this is; in NumPy, == does 
> 
> In [1]: np.array([1,2,3]) == np.array([1,3,3])
> Out[1]: array([ True, False,  True], dtype=bool)

Since afa3dedfee18 we compare memoryviews and any exporter in the same manner
as NumPy, except that the return value is a single boolean. So I think the new
comparison is equivalent to all(a == b) in NumPy.
History
Date User Action Args
2012-08-31 08:26:49skrahsetrecipients: + skrah, loewis, georg.brandl, mark.dickinson, ncoghlan, belopolsky, pitrou, scoder, vstinner, christian.heimes, Arfrever, meador.inge, Dag.Sverre.Seljebotn
2012-08-31 08:26:49skrahlinkissue15814 messages
2012-08-31 08:26:47skrahcreate