[Python-checkins] r57203 - python/branches/alex-py3k/Modules/_bytesiomodule.c python/branches/alex-py3k/Modules/_stringiomodule.c

alexandre.vassalotti python-checkins at python.org
Mon Aug 20 01:16:06 CEST 2007


Author: alexandre.vassalotti
Date: Mon Aug 20 01:16:06 2007
New Revision: 57203
Modified:
 python/branches/alex-py3k/Modules/_bytesiomodule.c
 python/branches/alex-py3k/Modules/_stringiomodule.c
Log:
Remove undocumented _buffer attribute.
Modified: python/branches/alex-py3k/Modules/_bytesiomodule.c
==============================================================================
--- python/branches/alex-py3k/Modules/_bytesiomodule.c	(original)
+++ python/branches/alex-py3k/Modules/_bytesiomodule.c	Mon Aug 20 01:16:06 2007
@@ -118,32 +118,6 @@
 return PyBytes_FromStringAndSize(self->buf, self->string_size);
 }
 
-/* Not exposed as a method of BytesIO. */
-static int
-bytesio_setvalue(BytesIOObject *self, PyObject *value)
-{
- const char *bytes;
- Py_ssize_t len;
-
- self->pos = 0;
- self->string_size = 0;
-
- if (value == NULL)
- return 0;
-
- if (PyObject_AsCharBuffer(value, &bytes, &len) == -1)
- return -1;
-
- if (write_bytes(self, bytes, len) < 0) {
- return -1; /* out of memory */
- }
- /* Reset the position back to beginning-of-file, since
- write_bytes changed it. */
- self->pos = 0;
-
- return 0;
-}
-
 static PyObject *
 bytesio_isatty(BytesIOObject *self)
 {
@@ -594,8 +568,6 @@
 static PyGetSetDef BytesIO_getsetlist[] = {
 {"closed", (getter)bytesio_get_closed, NULL,
 "True if the file is closed."},
- {"_buffer", (getter)bytesio_getvalue, (setter)bytesio_setvalue,
- NULL},
 {0}, /* sentinel */
 };
 
Modified: python/branches/alex-py3k/Modules/_stringiomodule.c
==============================================================================
--- python/branches/alex-py3k/Modules/_stringiomodule.c	(original)
+++ python/branches/alex-py3k/Modules/_stringiomodule.c	Mon Aug 20 01:16:06 2007
@@ -118,31 +118,6 @@
 return PyUnicode_FromUnicode(self->buf, self->string_size);
 }
 
-/* Not exposed as a method of StringIO. */
-static int
-stringio_setvalue(StringIOObject *self, PyObject *value)
-{
- self->pos = 0;
- self->string_size = 0;
-
- if (value == NULL)
- return 0;
-
- if (!PyUnicode_Check(value)) {
- PyErr_SetString(PyExc_TypeError, "need a unicode object");
- return -1;
- }
- if ((write_str(self, PyUnicode_AsUnicode(value),
- PyUnicode_GetSize(value))) < 0) {
- return -1; /* out of memory */
- }
- /* Reset the position back to beginning-of-file, since
- write_str changed it. */
- self->pos = 0;
-
- return 0;
-}
-
 static PyObject *
 stringio_isatty(StringIOObject *self)
 {
@@ -557,8 +532,6 @@
 static PyGetSetDef StringIO_getsetlist[] = {
 {"closed", (getter)stringio_get_closed, NULL,
 "True if the file is closed"},
- {"_buffer", (getter)stringio_getvalue, (setter)stringio_setvalue,
- NULL},
 {0}, /* sentinel */
 };
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /