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 vpelletier
Recipients vpelletier
Date 2017-02-01.00:00:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1485907211.51.0.510192590668.issue29404@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-02-01 00:00:11vpelletiersetrecipients: + vpelletier
2017-02-01 00:00:11vpelletiersetmessageid: <1485907211.51.0.510192590668.issue29404@psf.upfronthosting.co.za>
2017-02-01 00:00:11vpelletierlinkissue29404 messages
2017-02-01 00:00:11vpelletiercreate