diff options
author | Benjamin Peterson <benjamin@python.org> | 2010-04-27 21:07:21 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2010-04-27 21:07:21 (GMT) |
commit | 95e392c1115f091160a2fe3d400ef5231546a646 (patch) | |
tree | 77f14a99c02cc06f479382649b02463a3afda78c /Lib/_pyio.py | |
parent | 06e34a9476f7b0cd14b1dcc023892d7193230703 (diff) | |
download | cpython-95e392c1115f091160a2fe3d400ef5231546a646.zip cpython-95e392c1115f091160a2fe3d400ef5231546a646.tar.gz cpython-95e392c1115f091160a2fe3d400ef5231546a646.tar.bz2 |
Merged revisions 80544 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r80544 | benjamin.peterson | 2010-04-27 16:01:54 -0500 (Tue, 27 Apr 2010) | 1 line
reject None as the buffering argument like the C implementation does #8546
........
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index c58548e..c9c4297 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -35,7 +35,7 @@ class BlockingIOError(IOError): self.characters_written = characters_written -def open(file: (str, bytes), mode: str = "r", buffering: int = None, +def open(file: (str, bytes), mode: str = "r", buffering: int = -1, encoding: str = None, errors: str = None, newline: str = None, closefd: bool = True) -> "IOBase": @@ -150,7 +150,7 @@ def open(file: (str, bytes), mode: str = "r", buffering: int = None, raise TypeError("invalid file: %r" % file) if not isinstance(mode, str): raise TypeError("invalid mode: %r" % mode) - if buffering is not None and not isinstance(buffering, int): + if not isinstance(buffering, int): raise TypeError("invalid buffering: %r" % buffering) if encoding is not None and not isinstance(encoding, str): raise TypeError("invalid encoding: %r" % encoding) @@ -187,8 +187,6 @@ def open(file: (str, bytes), mode: str = "r", buffering: int = 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 |