Message76849
I'm unsure of the expected behavior in this case but it seems odd. The
bytearray in the following example can be resized to a length of 5-10
bytes without throwing an exception.
Python 3.0rc3 (r30rc3:67312, Dec 3 2008, 10:38:14)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
>>> b = bytearray(b'x' * 10)
>>> v = memoryview(b)
>>> b[:] = b'y' * 11
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
BufferError: Existing exports of data: object cannot be re-sized
>>> b[:] = b'y' * 5
>>> b
bytearray(b'yyyyy')
>>> v.tobytes()
b'yyyyy\x00xxxx'
>>> v2 = memoryview(b)
>>> v2.tobytes()
b'yyyyy' |
|
Date |
User |
Action |
Args |
2008-12-03 22:06:38 | gumpy | set | recipients:
+ gumpy |
2008-12-03 22:06:38 | gumpy | set | messageid: <1228341998.62.0.651194722962.issue4509@psf.upfronthosting.co.za> |
2008-12-03 22:06:38 | gumpy | link | issue4509 messages |
2008-12-03 22:06:37 | gumpy | create | |
|