Message286567
Quoting a github gist[1] (not mine, I found it while googling for this error) clearly illustrating the issue:
# Python 2
>>> b = bytearray(8)
>>> v = memoryview(b)
>>> v[0] = 42
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' does not have the buffer interface
>>> b
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00')
# Python 3
>>> b = bytearray(8)
>>> v = memoryview(b)
>>> v[0] = 42
>>> b
bytearray(b'*\x00\x00\x00\x00\x00\x00\x00')
This is especially annoying as on python3 bytearray.__setitem__ only accepts integers, making working py2 code totally incompatible with py3 in a 2to3-undetectable way.
[1] https://gist.github.com/superbobry/b90c0cc7c44beaa51ef9 |
|
Date |
User |
Action |
Args |
2017-02-01 00:00:11 | vpelletier | set | recipients:
+ vpelletier |
2017-02-01 00:00:11 | vpelletier | set | messageid: <1485907211.51.0.510192590668.issue29404@psf.upfronthosting.co.za> |
2017-02-01 00:00:11 | vpelletier | link | issue29404 messages |
2017-02-01 00:00:11 | vpelletier | create | |
|