]> granicus.if.org Git - python/commitdiff
just throw a normal AttributeError for no buffer attribute
authorBenjamin Peterson <benjamin@python.org>
Sun, 14 Jun 2009 18:32:19 +0000 (18:32 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 14 Jun 2009 18:32:19 +0000 (18:32 +0000)
Misc/NEWS
Modules/_io/stringio.c

index 407681b3d65bf55adc09ad9518196c87bc11ec42..1ec5c53cdaea0c98c01595591f56833aea081a8b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,9 @@ Core and Builtins
 Library
 -------
 
+- Accessing io.StringIO.buffer now raises an AttributeError instead of
+  io.UnsupportedOperation.
+
 - Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
   (On Unix)
 
index 57dacf99aeae7e79f70df44d9ce89fe272ef9dff..84a15bedc22c6bcc164602ec7bdd33df7e8363b1 100644 (file)
@@ -645,14 +645,6 @@ stringio_writable(stringio *self, PyObject *args)
     Py_RETURN_TRUE;
 }
 
-static PyObject *
-stringio_buffer(stringio *self, void *context)
-{
-    PyErr_SetString(IO_STATE->unsupported_operation,
-                    "buffer attribute is unsupported on type StringIO");
-    return NULL;
-}
-
 static PyObject *
 stringio_closed(stringio *self, void *context)
 {
@@ -703,7 +695,6 @@ static PyGetSetDef stringio_getset[] = {
         Hopefully, a better solution, than adding these pseudo-attributes,
         will be found.
     */
-    {"buffer",         (getter)stringio_buffer,         NULL, NULL},
     {"line_buffering", (getter)stringio_line_buffering, NULL, NULL},
     {NULL}
 };