New submission from Thomas Heller <[EMAIL PROTECTED]>:

IIUC, the bytes object should be immutable (in contrast to bytearray). 
But PyObject_FromWriteBuffer() does not fail.

It seems that the attached patch fixes it; however there are lots of
failures in the testsuite with the patch - even 'memoryview(b"abcd")' fails.

Index: stringobject.c
===================================================================
--- stringobject.c      (revision 62498)
+++ stringobject.c      (working copy)
@@ -966,7 +966,7 @@
 string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags)
 {
        return PyBuffer_FillInfo(view, (void *)self->ob_sval, Py_SIZE(self),
-                                0, flags);
+                                1, flags);
 }
 
 static PySequenceMethods string_as_sequence = {

----------
components: Interpreter Core
messages: 65796
nosy: theller
severity: normal
status: open
title: bytes object wrongly exposes writeable buffer interface
versions: Python 3.0

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2692>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to