[issue5517] 2to3 haven't convert buffer object to memoryview
Haoyu Bai
report at bugs.python.org
Thu Mar 19 08:11:02 CET 2009
New submission from Haoyu Bai <divinekid at gmail.com>:
The following example is valid in Python 2.6:
a = 'abc'
b = buffer(a)
print([repr(c) for c in b])
After 2to3 it, the 'buffer' isn't changed to memoryview, so then it is
not valid program in Python 3:
Traceback (most recent call last):
File "bufferobj3.py", line 2, in <module>
b = buffer(a)
NameError: name 'buffer' is not defined
However even it changed to memoryview the program still not valid because:
>>> memoryview('a')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot make memory view because object does not have the
buffer interface
I can reporduce this on both Python 3.0.1 and Python 3.1a1+ (py3k:70310).
Thanks!
----------
components: 2to3 (2.x to 3.0 conversion tool)
messages: 83802
nosy: bhy
severity: normal
status: open
title: 2to3 haven't convert buffer object to memoryview
type: feature request
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5517>
_______________________________________
More information about the Python-bugs-list
mailing list