@@ -233,7 +233,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
233233 if (fd < 0 ) {
234234 if (!PyErr_Occurred ()) {
235235 PyErr_SetString (PyExc_ValueError ,
236- "Negative filedescriptor " );
236+ "negative file descriptor " );
237237 return -1 ;
238238 }
239239 PyErr_Clear ();
@@ -1014,10 +1014,10 @@ fileio_getstate(fileio *self)
10141014PyDoc_STRVAR (fileio_doc ,
10151015"file(name: str[, mode: str][, opener: None]) -> file IO object\n"
10161016"\n"
1017- "Open a file. The mode can be 'r', 'w', 'x' or 'a' for reading (default) ,\n"
1017+ "Open a file. The mode can be 'r' (default) , 'w', 'x' or 'a' for reading,\n"
10181018"writing, exclusive creation or appending. The file will be created if it\n"
10191019"doesn't exist when opened for writing or appending; it will be truncated\n"
1020- "when opened for writing. A ` FileExistsError` will be raised if it already\n"
1020+ "when opened for writing. A FileExistsError will be raised if it already\n"
10211021"exists when opened for creating. Opening a file for creating implies\n"
10221022"writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode\n"
10231023"to allow simultaneous reading and writing. A custom opener can be used by\n"
@@ -1043,22 +1043,22 @@ PyDoc_STRVAR(write_doc,
10431043"write(b: bytes) -> int. Write bytes b to file, return number written.\n"
10441044"\n"
10451045"Only makes one system call, so not all of the data may be written.\n"
1046- "The number of bytes actually written is returned." );
1046+ "The number of bytes actually written is returned. In non-blocking mode,\n"
1047+ "returns None if the write would block."
1048+ );
10471049
10481050PyDoc_STRVAR (fileno_doc ,
1049- "fileno() -> int. \"file descriptor\".\n"
1050- "\n"
1051- "This is needed for lower-level file interfaces, such the fcntl module." );
1051+ "fileno() -> int. Return the underlying file descriptor (an integer)." );
10521052
10531053PyDoc_STRVAR (seek_doc ,
10541054"seek(offset: int[, whence: int]) -> int. Move to new file position and\n"
10551055"return the file position.\n"
10561056"\n"
10571057"Argument offset is a byte count. Optional argument whence defaults to\n"
1058- "0 (offset from start of file, offset should be >= 0); other values are 1 \n"
1059- "(move relative to current position, positive or negative), and 2 (move \n"
1060- "relative to end of file, usually negative, although many platforms allow \n"
1061- "seeking beyond the end of a file)."
1058+ "SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values\n"
1059+ "are SEEK_CUR or 1 (move relative to current position, positive or negative),\n"
1060+ "and SEEK_END or 2 (move relative to end of file, usually negative, although\n"
1061+ "many platforms allow seeking beyond the end of a file).\n "
10621062"\n"
10631063"Note that not all file objects are seekable." );
10641064
@@ -1072,7 +1072,10 @@ PyDoc_STRVAR(truncate_doc,
10721072#endif
10731073
10741074PyDoc_STRVAR (tell_doc ,
1075- "tell() -> int. Current file position" );
1075+ "tell() -> int. Current file position.\n"
1076+ "\n"
1077+ "Can raise OSError for non seekable files."
1078+ );
10761079
10771080PyDoc_STRVAR (readinto_doc ,
10781081"readinto() -> Same as RawIOBase.readinto()." );
@@ -1081,10 +1084,10 @@ PyDoc_STRVAR(close_doc,
10811084"close() -> None. Close the file.\n"
10821085"\n"
10831086"A closed file cannot be used for further I/O operations. close() may be\n"
1084- "called more than once without error. Changes the fileno to -1. " );
1087+ "called more than once without error." );
10851088
10861089PyDoc_STRVAR (isatty_doc ,
1087- "isatty() -> bool. True if the file is connected to a tty device." );
1090+ "isatty() -> bool. True if the file is connected to a TTY device." );
10881091
10891092PyDoc_STRVAR (seekable_doc ,
10901093"seekable() -> bool. True if file supports random-access." );
@@ -1139,7 +1142,7 @@ get_mode(fileio *self, void *closure)
11391142static PyGetSetDef fileio_getsetlist [] = {
11401143 {"closed" , (getter )get_closed , NULL , "True if the file is closed" },
11411144 {"closefd" , (getter )get_closefd , NULL ,
1142- "True if the file descriptor will be closed" },
1145+ "True if the file descriptor will be closed by close(). " },
11431146 {"mode" , (getter )get_mode , NULL , "String giving the file mode" },
11441147 {NULL },
11451148};
0 commit comments