diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-04-27 21:01:54 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-04-27 21:01:54 +0000 |
commit | a9bd6d5ea7b822e12fa3c080fe24b04a87bcae56 (patch) | |
tree | 5691762d0c9c265d9d5e1fdbad192671e9c8aea2 | |
parent | 1dc6b08f9efe471cc5983cdfcdb391eea505a5e0 (diff) | |
download | cpython-git-a9bd6d5ea7b822e12fa3c080fe24b04a87bcae56.tar.gz |
reject None as the buffering argument like the C implementation does #8546
-rw-r--r-- | Doc/library/io.rst | 2 | ||||
-rw-r--r-- | Lib/_pyio.py | 6 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst index adde553c51..cf5e9f766d 100644 --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -61,7 +61,7 @@ Module Interface classes. :func:`.open` uses the file's blksize (as obtained by :func:`os.stat`) if possible. -.. function:: open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True) +.. function:: open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True) Open *file* and return a corresponding stream. If the file cannot be opened, an :exc:`IOError` is raised. diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 8098681067..cafc51ccc7 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -40,7 +40,7 @@ class BlockingIOError(IOError): self.characters_written = characters_written -def open(file, mode="r", buffering=None, +def open(file, mode="r", buffering=-1, encoding=None, errors=None, newline=None, closefd=True): @@ -155,7 +155,7 @@ def open(file, mode="r", buffering=None, raise TypeError("invalid file: %r" % file) if not isinstance(mode, basestring): raise TypeError("invalid mode: %r" % mode) - if buffering is not None and not isinstance(buffering, (int, long)): + if not isinstance(buffering, (int, long)): raise TypeError("invalid buffering: %r" % buffering) if encoding is not None and not isinstance(encoding, basestring): raise TypeError("invalid encoding: %r" % encoding) @@ -192,8 +192,6 @@ def open(file, mode="r", buffering=None, (appending and "a" or "") + (updating and "+" or ""), closefd) - if buffering is None: - buffering = -1 line_buffering = False if buffering == 1 or buffering < 0 and raw.isatty(): buffering = -1 @@ -27,6 +27,8 @@ Core and Builtins Library ------- +- Issue #8546: Reject None given as the buffering argument to _pyio.open. + - Issue #8549: Fix compiling the _ssl extension under AIX. Patch by Sridhar Ratnakumar. |