Index: Objects/stringobject.c =================================================================== --- Objects/stringobject.c (revision 62116) +++ Objects/stringobject.c (working copy) @@ -962,7 +962,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 = { Index: Objects/memoryobject.c =================================================================== --- Objects/memoryobject.c (revision 62116) +++ Objects/memoryobject.c (working copy) @@ -56,7 +56,7 @@ if (mview == NULL) return NULL; mview->base = NULL; - if (PyObject_GetBuffer(base, &(mview->view), PyBUF_FULL) < 0) { + if (PyObject_GetBuffer(base, &(mview->view), PyBUF_FULL_RO) < 0) { Py_DECREF(mview); return NULL; } Index: Objects/abstract.c =================================================================== --- Objects/abstract.c (revision 62116) +++ Objects/abstract.c (working copy) @@ -673,7 +673,7 @@ { if (view == NULL) return 0; if (((flags & PyBUF_LOCK) == PyBUF_LOCK) && - readonly != 0) { + readonly == 0) { PyErr_SetString(PyExc_BufferError, "Cannot lock this object."); return -1; Index: Lib/test/test_socket.py =================================================================== --- Lib/test/test_socket.py (revision 62116) +++ Lib/test/test_socket.py (working copy) @@ -1096,7 +1096,7 @@ SocketConnectedTest.__init__(self, methodName=methodName) def testRecvInto(self): - buf = b" "*1024 + buf = bytearray(b" ") * 1024 nbytes = self.cli_conn.recv_into(buf) self.assertEqual(nbytes, len(MSG)) msg = buf[:len(MSG)] @@ -1107,7 +1107,7 @@ self.serv_conn.send(buf) def testRecvFromInto(self): - buf = b" "*1024 + buf = bytearray(b" ") * 1024 nbytes, addr = self.cli_conn.recvfrom_into(buf) self.assertEqual(nbytes, len(MSG)) msg = buf[:len(MSG)]