mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +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
|
||||
char *msg = "Is a directory";
|
||||
#endif
|
||||
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)", EISDIR, msg);
|
||||
PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)",
|
||||
EISDIR, msg);
|
||||
PyErr_SetObject(PyExc_IOError, exc);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -755,7 +756,8 @@ file_readinto(PyFileObject *f, PyObject *args)
|
|||
while (ntodo > 0) {
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
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
|
||||
if (nnow == 0) {
|
||||
if (!ferror(f->f_fp))
|
||||
|
@ -1025,8 +1027,9 @@ get_line(PyFileObject *f, int n)
|
|||
if (skipnextlf ) {
|
||||
skipnextlf = 0;
|
||||
if (c == '\n') {
|
||||
/* Seeing a \n here with skipnextlf true
|
||||
** means we saw a \r before.
|
||||
/* Seeing a \n here with
|
||||
* skipnextlf true means we
|
||||
* saw a \r before.
|
||||
*/
|
||||
newlinetypes |= NEWLINE_CRLF;
|
||||
c = GETC(fp);
|
||||
|
@ -1594,7 +1597,9 @@ get_newlines(PyFileObject *f, void *closure)
|
|||
case NEWLINE_CR|NEWLINE_LF|NEWLINE_CRLF:
|
||||
return Py_BuildValue("(sss)", "\r", "\n", "\r\n");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1603,7 +1608,8 @@ get_newlines(PyFileObject *f, void *closure)
|
|||
static PyGetSetDef file_getsetlist[] = {
|
||||
{"closed", (getter)get_closed, NULL, "True if the file is closed"},
|
||||
#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
|
||||
{0},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue