New submission from Haoyu Bai <divine...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue5517>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to