diff options
author | Georg Brandl <georg@python.org> | 2006-05-18 07:01:27 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-05-18 07:01:27 (GMT) |
commit | 7b90e168f3d27f10cc087da2b9be1289722e7172 (patch) | |
tree | f2f5027e63e3a10ae21ee9abbf5d25dc57f45917 /Doc | |
parent | b678ce5aa67d890bb080df19fa35a232a19dac65 (diff) | |
download | cpython-7b90e168f3d27f10cc087da2b9be1289722e7172.zip cpython-7b90e168f3d27f10cc087da2b9be1289722e7172.tar.gz cpython-7b90e168f3d27f10cc087da2b9be1289722e7172.tar.bz2 |
Bug #1462152: file() now checks more thoroughly for invalid mode
strings and removes a possible "U" before passing the mode to the
C library function.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libfuncs.tex | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index ff81faa..7cfdfbb 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -418,7 +418,7 @@ class C: that differentiate between binary and text files (else it is ignored). If the file cannot be opened, \exception{IOError} is raised. - + In addition to the standard \cfunction{fopen()} values \var{mode} may be \code{'U'} or \code{'rU'}. If Python is built with universal newline support (the default) the file is opened as a text file, but @@ -434,6 +434,9 @@ class C: have yet been seen), \code{'\e n'}, \code{'\e r'}, \code{'\e r\e n'}, or a tuple containing all the newline types seen. + Python enforces that the mode, after stripping \code{'U'}, begins with + \code{'r'}, \code{'w'} or \code{'a'}. + If \var{mode} is omitted, it defaults to \code{'r'}. When opening a binary file, you should append \code{'b'} to the \var{mode} value for improved portability. (It's useful even on systems which don't @@ -456,6 +459,9 @@ class C: determine whether this is the case.} \versionadded{2.2} + + \versionchanged[Restriction on first letter of mode string + introduced]{2.5} \end{funcdesc} \begin{funcdesc}{filter}{function, list} |