[Python-3000-checkins] r56605 - python/branches/py3k-struni/Modules/cStringIO.c
Guido van Rossum
guido at python.org
Sat Jul 28 23:57:45 CEST 2007
Actually, I'd like to get rid of cStringIO.c and StringIO.py, and
replace all these with io.StringIO or io.BytesIO. I believe Alessandro
Vassellotti (sp?) is working on new accelerators.
On 7/28/07, martin.v.loewis <python-3000-checkins at python.org> wrote:
> Author: martin.v.loewis
> Date: Sat Jul 28 19:51:59 2007
> New Revision: 56605
>
> Modified:
> python/branches/py3k-struni/Modules/cStringIO.c
> Log:
> Return bytes, not str8.
>
>
> Modified: python/branches/py3k-struni/Modules/cStringIO.c
> ==============================================================================
> --- python/branches/py3k-struni/Modules/cStringIO.c (original)
> +++ python/branches/py3k-struni/Modules/cStringIO.c Sat Jul 28 19:51:59 2007
> @@ -118,8 +118,8 @@
> static PyObject *
> IO_cgetval(PyObject *self) {
> if (!IO__opencheck(IOOOBJECT(self))) return NULL;
> - return PyString_FromStringAndSize(((IOobject*)self)->buf,
> - ((IOobject*)self)->pos);
> + return PyBytes_FromStringAndSize(((IOobject*)self)->buf,
> + ((IOobject*)self)->pos);
> }
>
> static PyObject *
> @@ -136,7 +136,7 @@
> }
> else
> s=self->string_size;
> - return PyString_FromStringAndSize(self->buf, s);
> + return PyBytes_FromStringAndSize(self->buf, s);
> }
>
> PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0");
> @@ -176,7 +176,7 @@
>
> if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL;
>
> - return PyString_FromStringAndSize(output, n);
> + return PyBytes_FromStringAndSize(output, n);
> }
>
> PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line");
> @@ -214,7 +214,7 @@
> n -= m;
> self->pos -= m;
> }
> - return PyString_FromStringAndSize(output, n);
> + return PyBytes_FromStringAndSize(output, n);
> }
>
> PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines");
> @@ -237,7 +237,7 @@
> goto err;
> if (n == 0)
> break;
> - line = PyString_FromStringAndSize (output, n);
> + line = PyBytes_FromStringAndSize (output, n);
> if (!line)
> goto err;
> if (PyList_Append (result, line) == -1) {
> @@ -314,7 +314,7 @@
> next = IO_readline((IOobject *)self, NULL);
> if (!next)
> return NULL;
> - if (!PyString_GET_SIZE(next)) {
> + if (!PyBytes_GET_SIZE(next)) {
> Py_DECREF(next);
> PyErr_SetNone(PyExc_StopIteration);
> return NULL;
> _______________________________________________
> Python-3000-checkins mailing list
> Python-3000-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-3000-checkins
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000-checkins
mailing list