Issue2784
Created on 2019-07-17.23:53:41 by behackett, last changed 2019-09-01.14:07:42 by jeff.allen.
msg12578 (view) |
Author: Bernie Hackett (behackett) |
Date: 2019-07-17.23:53:41 |
|
In CPython 2 and 3 and PyPy 2 and 3 memoryview only accepts objects that implement the buffer protocol. unicode / python3 str don't implement the buffer protocol so memoryview doesn't accept them, but memoryview in Jython does.
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_202
Type "help", "copyright", "credits" or "license" for more information.
>>> memoryview(u"foobar").tobytes()
'foobar'
Python 3.6.9 (default, Jul 17 2019, 12:02:47)
[GCC 9.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> memoryview(u"foobar").tobytes()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: memoryview: a bytes-like object is required, not 'str'
>>>
Python 2.7.16 (default, Mar 6 2019, 09:58:35)
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> memoryview(u"foobar").tobytes()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot make memory view because object does not have the buffer interface
|
msg12600 (view) |
Author: Jeff Allen (jeff.allen) |
Date: 2019-07-21.07:07:54 |
|
I'm happy to report that's fixed, as a result of work on #2715. 2.7.2a1 currently does this:
>>> memoryview(u"foobar")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: cannot make memory view because object does not have the buffer interface
|
|
Date |
User |
Action |
Args |
2019-09-01 14:07:42 | jeff.allen | set | status: pending -> closed |
2019-07-21 07:07:54 | jeff.allen | set | status: open -> pending nosy:
+ jeff.allen messages:
+ msg12600 dependencies:
+ Restrict array.array support for buffer protocol milestone: Jython 2.7.2 resolution: duplicate |
2019-07-17 23:53:41 | behackett | create | |
|