]> granicus.if.org Git - python/commitdiff
Preemptively backport the relevant parts of r65420
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 2 Aug 2008 21:58:05 +0000 (21:58 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 2 Aug 2008 21:58:05 +0000 (21:58 +0000)
Lib/test/test_str.py
Objects/stringobject.c

index 535e66ac292d2d626a78c9ec22c023d17227875d..044711cad512ef57507735fef12c11977c52ff69 100644 (file)
@@ -364,6 +364,9 @@ class StrTest(
         self.assertRaises(ValueError, format, "", "-")
         self.assertRaises(ValueError, "{0:=s}".format, '')
 
+    def test_buffer_is_readonly(self):
+        self.assertRaises(TypeError, sys.stdin.readinto, b"")
+
 
 def test_main():
     test_support.run_unittest(StrTest)
index 0d2ceb1b7f5561739b704ccee7b1f2acbc281ebf..6d53a099f87ac9f311151173b6c06086ef004f8b 100644 (file)
@@ -1329,7 +1329,7 @@ static int
 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 = {