[issue10451] memoryview can be used to write into readonly buffer
Antoine Pitrou
report at bugs.python.org
Tue Jan 18 16:59:43 CET 2011
Antoine Pitrou <pitrou at free.fr> added the comment:
The patch produces a failure in test_getargs2, but that test is wrong and should be fixed:
======================================================================
ERROR: test_w_star (test.test_getargs2.Bytes_TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/antoine/py3k/__svn__/Lib/test/test_getargs2.py", line 385, in test_w_star
self.assertEqual(getargs_w_star(memoryview(b'memoryview')), b'[emoryvie]')
TypeError: must be read-write buffer, not memoryview
I'm surprised no other test failures arise. I did add that line (which I commented with "XXX for whatever reason...") for a reason, but I don't remember which one. It seemed necessary at the time, I'm glad it isn't anymore.
So, about the patch itself: you should simply use assertRaises. There's no reason for readinto() not to fail with a TypeError (silent failure is wrong). Thank you.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10451>
_______________________________________
More information about the Python-bugs-list
mailing list