mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Reflow long lines.
This commit is contained in:
parent
794643c314
commit
8b73542cf5
1 changed files with 32 additions and 26 deletions
|
@ -90,7 +90,8 @@ dircheck(PyFileObject* f)
|
||||||
#else
|
#else
|
||||||
char *msg = "Is a directory";
|
char *msg = "Is a directory";
|
||||||
#endif
|
#endif
|
||||||
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)", EISDIR, msg);
|
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)",
|
||||||
|
EISDIR, msg);
|
||||||
PyErr_SetObject(PyExc_IOError, exc);
|
PyErr_SetObject(PyExc_IOError, exc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -755,7 +756,8 @@ file_readinto(PyFileObject *f, PyObject *args)
|
||||||
while (ntodo > 0) {
|
while (ntodo > 0) {
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
errno = 0;
|
errno = 0;
|
||||||
nnow = Py_UniversalNewlineFread(ptr+ndone, ntodo, f->f_fp, (PyObject *)f);
|
nnow = Py_UniversalNewlineFread(ptr+ndone, ntodo, f->f_fp,
|
||||||
|
(PyObject *)f);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
if (nnow == 0) {
|
if (nnow == 0) {
|
||||||
if (!ferror(f->f_fp))
|
if (!ferror(f->f_fp))
|
||||||
|
@ -1025,8 +1027,9 @@ get_line(PyFileObject *f, int n)
|
||||||
if (skipnextlf ) {
|
if (skipnextlf ) {
|
||||||
skipnextlf = 0;
|
skipnextlf = 0;
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
/* Seeing a \n here with skipnextlf true
|
/* Seeing a \n here with
|
||||||
** means we saw a \r before.
|
* skipnextlf true means we
|
||||||
|
* saw a \r before.
|
||||||
*/
|
*/
|
||||||
newlinetypes |= NEWLINE_CRLF;
|
newlinetypes |= NEWLINE_CRLF;
|
||||||
c = GETC(fp);
|
c = GETC(fp);
|
||||||
|
@ -1544,9 +1547,9 @@ static PyMethodDef file_methods[] = {
|
||||||
#endif
|
#endif
|
||||||
{"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc},
|
{"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc},
|
||||||
{"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc},
|
{"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc},
|
||||||
{"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc},
|
{"readlines", (PyCFunction)file_readlines,METH_VARARGS, readlines_doc},
|
||||||
{"xreadlines", (PyCFunction)file_getiter, METH_NOARGS, xreadlines_doc},
|
{"xreadlines",(PyCFunction)file_getiter, METH_NOARGS, xreadlines_doc},
|
||||||
{"writelines", (PyCFunction)file_writelines, METH_O, writelines_doc},
|
{"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc},
|
||||||
{"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc},
|
{"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc},
|
||||||
{"close", (PyCFunction)file_close, METH_NOARGS, close_doc},
|
{"close", (PyCFunction)file_close, METH_NOARGS, close_doc},
|
||||||
{"isatty", (PyCFunction)file_isatty, METH_NOARGS, isatty_doc},
|
{"isatty", (PyCFunction)file_isatty, METH_NOARGS, isatty_doc},
|
||||||
|
@ -1594,7 +1597,9 @@ get_newlines(PyFileObject *f, void *closure)
|
||||||
case NEWLINE_CR|NEWLINE_LF|NEWLINE_CRLF:
|
case NEWLINE_CR|NEWLINE_LF|NEWLINE_CRLF:
|
||||||
return Py_BuildValue("(sss)", "\r", "\n", "\r\n");
|
return Py_BuildValue("(sss)", "\r", "\n", "\r\n");
|
||||||
default:
|
default:
|
||||||
PyErr_Format(PyExc_SystemError, "Unknown newlines value 0x%x\n", f->f_newlinetypes);
|
PyErr_Format(PyExc_SystemError,
|
||||||
|
"Unknown newlines value 0x%x\n",
|
||||||
|
f->f_newlinetypes);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1603,7 +1608,8 @@ get_newlines(PyFileObject *f, void *closure)
|
||||||
static PyGetSetDef file_getsetlist[] = {
|
static PyGetSetDef file_getsetlist[] = {
|
||||||
{"closed", (getter)get_closed, NULL, "True if the file is closed"},
|
{"closed", (getter)get_closed, NULL, "True if the file is closed"},
|
||||||
#ifdef WITH_UNIVERSAL_NEWLINES
|
#ifdef WITH_UNIVERSAL_NEWLINES
|
||||||
{"newlines", (getter)get_newlines, NULL, "end-of-line convention used in this file"},
|
{"newlines", (getter)get_newlines, NULL,
|
||||||
|
"end-of-line convention used in this file"},
|
||||||
#endif
|
#endif
|
||||||
{0},
|
{0},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue