summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/io.rst2
-rw-r--r--Lib/_pyio.py6
-rw-r--r--Misc/NEWS2
3 files changed, 5 insertions, 5 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index c3ebe9a..4511ce6 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -56,7 +56,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 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
diff --git a/Misc/NEWS b/Misc/NEWS
index 2837ef9..ff469e7 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -339,6 +339,8 @@ C-API
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.