mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
This commit is contained in:
parent
e98839a1f4
commit
dd96db63f6
173 changed files with 2275 additions and 2280 deletions
|
@ -119,7 +119,7 @@ PyDoc_STRVAR(IO_getval__doc__,
|
|||
static PyObject *
|
||||
IO_cgetval(PyObject *self) {
|
||||
if (!IO__opencheck(IOOOBJECT(self))) return NULL;
|
||||
return PyBytes_FromStringAndSize(((IOobject*)self)->buf,
|
||||
return PyString_FromStringAndSize(((IOobject*)self)->buf,
|
||||
((IOobject*)self)->pos);
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ IO_getval(IOobject *self, PyObject *args) {
|
|||
}
|
||||
else
|
||||
s=self->string_size;
|
||||
return PyBytes_FromStringAndSize(self->buf, s);
|
||||
return PyString_FromStringAndSize(self->buf, s);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0");
|
||||
|
@ -177,7 +177,7 @@ IO_read(IOobject *self, PyObject *args) {
|
|||
|
||||
if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL;
|
||||
|
||||
return PyBytes_FromStringAndSize(output, n);
|
||||
return PyString_FromStringAndSize(output, n);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line");
|
||||
|
@ -215,7 +215,7 @@ IO_readline(IOobject *self, PyObject *args) {
|
|||
n -= m;
|
||||
self->pos -= m;
|
||||
}
|
||||
return PyBytes_FromStringAndSize(output, n);
|
||||
return PyString_FromStringAndSize(output, n);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines");
|
||||
|
@ -238,7 +238,7 @@ IO_readlines(IOobject *self, PyObject *args) {
|
|||
goto err;
|
||||
if (n == 0)
|
||||
break;
|
||||
line = PyBytes_FromStringAndSize (output, n);
|
||||
line = PyString_FromStringAndSize (output, n);
|
||||
if (!line)
|
||||
goto err;
|
||||
if (PyList_Append (result, line) == -1) {
|
||||
|
@ -315,7 +315,7 @@ IO_iternext(Iobject *self)
|
|||
next = IO_readline((IOobject *)self, NULL);
|
||||
if (!next)
|
||||
return NULL;
|
||||
if (!PyBytes_GET_SIZE(next)) {
|
||||
if (!PyString_GET_SIZE(next)) {
|
||||
Py_DECREF(next);
|
||||
PyErr_SetNone(PyExc_StopIteration);
|
||||
return NULL;
|
||||
|
@ -456,7 +456,7 @@ O_writelines(Oobject *self, PyObject *args) {
|
|||
while ((s = PyIter_Next(it)) != NULL) {
|
||||
Py_ssize_t n;
|
||||
char *c;
|
||||
if (PyBytes_AsStringAndSize(s, &c, &n) == -1) {
|
||||
if (PyString_AsStringAndSize(s, &c, &n) == -1) {
|
||||
Py_DECREF(it);
|
||||
Py_DECREF(s);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue