summaryrefslogtreecommitdiffstats
path: root/Lib/fileinput.py
diff options
context:
space:
mode:
authorMatthias Bussonnier <mbussonnier@ucmerced.edu>2019-05-20 20:44:11 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-05-20 20:44:11 (GMT)
commit1a3faf9d9740a8c7505c61839ef09929a7ff9e35 (patch)
treebdd3def7859b69fa221e5350842801dd381fdf5c /Lib/fileinput.py
parent4011d865d0572a3dd9988f2935cd835cc8fb792a (diff)
downloadcpython-1a3faf9d9740a8c7505c61839ef09929a7ff9e35.zip
cpython-1a3faf9d9740a8c7505c61839ef09929a7ff9e35.tar.gz
cpython-1a3faf9d9740a8c7505c61839ef09929a7ff9e35.tar.bz2
bpo-36952: Remove the bufsize parameter in fileinput.input(). (GH-13400)
This parameter is marked as deprecated since 3.6 and for removal in 3.8. It already had no effects.
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r--Lib/fileinput.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py
index 0764aa5..d868e74 100644
--- a/Lib/fileinput.py
+++ b/Lib/fileinput.py
@@ -80,8 +80,7 @@ __all__ = ["input", "close", "nextfile", "filename", "lineno", "filelineno",
_state = None
-def input(files=None, inplace=False, backup="", bufsize=0,
- mode="r", openhook=None):
+def input(files=None, inplace=False, backup="", *, mode="r", openhook=None):
"""Return an instance of the FileInput class, which can be iterated.
The parameters are passed to the constructor of the FileInput class.
@@ -91,7 +90,7 @@ def input(files=None, inplace=False, backup="", bufsize=0,
global _state
if _state and _state._file:
raise RuntimeError("input() already active")
- _state = FileInput(files, inplace, backup, bufsize, mode, openhook)
+ _state = FileInput(files, inplace, backup, mode=mode, openhook=openhook)
return _state
def close():
@@ -173,7 +172,7 @@ def isstdin():
return _state.isstdin()
class FileInput:
- """FileInput([files[, inplace[, backup[, bufsize, [, mode[, openhook]]]]]])
+ """FileInput([files[, inplace[, backup]]], *, mode=None, openhook=None)
Class FileInput is the implementation of the module; its methods
filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
@@ -185,7 +184,7 @@ class FileInput:
sequential order; random access and readline() cannot be mixed.
"""
- def __init__(self, files=None, inplace=False, backup="", bufsize=0,
+ def __init__(self, files=None, inplace=False, backup="", *,
mode="r", openhook=None):
if isinstance(files, str):
files = (files,)
@@ -201,10 +200,6 @@ class FileInput:
self._files = files
self._inplace = inplace
self._backup = backup
- if bufsize:
- import warnings
- warnings.warn('bufsize is deprecated and ignored',
- DeprecationWarning, stacklevel=2)
self._savestdout = None
self._output = None
self._filename = None