diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-13 08:37:05 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-13 08:37:05 +0200 |
commit | cea403188c49d053e716a0b1b07a99a5f1331d9d (patch) | |
tree | 5428d97438415a040bd1261d7f51761f6d3cf158 /Lib/fileinput.py | |
parent | 8e1ab1485c63659b150be58f4a3676313113b7eb (diff) | |
parent | bae3b66047d7773d198916a3fd42c539d0566232 (diff) | |
download | cpython-cea403188c49d053e716a0b1b07a99a5f1331d9d.tar.gz |
Py_SIZE() was misused for dict.
Diffstat (limited to 'Lib/fileinput.py')
-rw-r--r-- | Lib/fileinput.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py index d2b52066d9..721fe9c961 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -75,13 +75,11 @@ XXX Possible additions: import sys, os __all__ = ["input", "close", "nextfile", "filename", "lineno", "filelineno", - "isfirstline", "isstdin", "FileInput"] + "fileno", "isfirstline", "isstdin", "FileInput", "hook_compressed", + "hook_encoded"] _state = None -# No longer used -DEFAULT_BUFSIZE = 8*1024 - def input(files=None, inplace=False, backup="", bufsize=0, mode="r", openhook=None): """Return an instance of the FileInput class, which can be iterated. @@ -201,6 +199,10 @@ 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 @@ -398,9 +400,9 @@ def hook_compressed(filename, mode): return open(filename, mode) -def hook_encoded(encoding): +def hook_encoded(encoding, errors=None): def openhook(filename, mode): - return open(filename, mode, encoding=encoding) + return open(filename, mode, encoding=encoding, errors=errors) return openhook |