Skip to content

Commit 6a38ced

Browse files
committed
just throw a normal AttributeError for no buffer attribute
1 parent 2a8b54d commit 6a38ced

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Core and Builtins
1515
Library
1616
-------
1717

18+
- Accessing io.StringIO.buffer now raises an AttributeError instead of
19+
io.UnsupportedOperation.
20+
1821
- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
1922
(On Unix)
2023

Modules/_io/stringio.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,6 @@ stringio_writable(stringio *self, PyObject *args)
645645
Py_RETURN_TRUE;
646646
}
647647

648-
static PyObject *
649-
stringio_buffer(stringio *self, void *context)
650-
{
651-
PyErr_SetString(IO_STATE->unsupported_operation,
652-
"buffer attribute is unsupported on type StringIO");
653-
return NULL;
654-
}
655-
656648
static PyObject *
657649
stringio_closed(stringio *self, void *context)
658650
{
@@ -703,7 +695,6 @@ static PyGetSetDef stringio_getset[] = {
703695
Hopefully, a better solution, than adding these pseudo-attributes,
704696
will be found.
705697
*/
706-
{"buffer", (getter)stringio_buffer, NULL, NULL},
707698
{"line_buffering", (getter)stringio_line_buffering, NULL, NULL},
708699
{NULL}
709700
};

0 commit comments

Comments
 (0)