homepage

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 eryksun
Recipients Yury.Selivanov, belopolsky, eryksun, methane, ncoghlan, serhiy.storchaka, vstinner, xiang.zhang, yselivanov
Date 2017年01月08日.03:22:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483845763.9.0.721185667787.issue29178@psf.upfronthosting.co.za>
In-reply-to
Content
Isn't the proposed workaround also relying on CPython reference counting to immediately deallocate the sliced view? It fails if I keep a reference to the sliced view:
 byteslike = bytearray(b'abc')
 with memoryview(byteslike) as m1:
 m2 = m1[1:]
 bs = bytes(m2)
 
 >>> byteslike += b'd'
 Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 BufferError: Existing exports of data: object cannot be re-sized
It seems to me that it should be written as follows:
 with memoryview(byteslike) as m1:
 with m1[1:] as m2:
 bs = bytes(m2)
 >>> byteslike += b'd'
 >>> byteslike
 bytearray(b'abcd')
The memoryview constructor could take start, stop, and step keyword-only arguments to avoid having to immediately slice a new view.
History
Date User Action Args
2017年01月08日 03:22:43eryksunsetrecipients: + eryksun, ncoghlan, belopolsky, vstinner, methane, Yury.Selivanov, serhiy.storchaka, yselivanov, xiang.zhang
2017年01月08日 03:22:43eryksunsetmessageid: <1483845763.9.0.721185667787.issue29178@psf.upfronthosting.co.za>
2017年01月08日 03:22:43eryksunlinkissue29178 messages
2017年01月08日 03:22:43eryksuncreate

AltStyle によって変換されたページ (->オリジナル) /