Skip to content
Prev Previous commit
Next Next commit
Update docs for codecs.open()
  • Loading branch information
Alexey Izbyshev committed Sep 11, 2018
commit cec8cd7b3efdce65ef35acfec869d47ed18dfdba
6 changes: 3 additions & 3 deletions Doc/library/codecs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ recommended approach for working with encoded text files, this module
provides additional utility functions and classes that allow the use of a
wider range of codecs when working with binary files:

.. function:: open(filename, mode='r', encoding=None, errors='strict', buffering=1)
.. function:: open(filename, mode='r', encoding=None, errors='strict', buffering=-1)

Open an encoded file using the given *mode* and return an instance of
:class:`StreamReaderWriter`, providing transparent encoding/decoding.
Expand All @@ -194,8 +194,8 @@ wider range of codecs when working with binary files:
*errors* may be given to define the error handling. It defaults to ``'strict'``
which causes a :exc:`ValueError` to be raised in case an encoding error occurs.

*buffering* has the same meaning as for the built-in :func:`open` function. It
defaults to line buffered.
*buffering* has the same meaning as for the built-in :func:`open` function.
It defaults to -1 which means that the default buffer size will be used.


.. function:: EncodedFile(file, data_encoding, file_encoding=None, errors='strict')
Expand Down
3 changes: 2 additions & 1 deletion Lib/codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,8 @@ def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
encoding error occurs.

buffering has the same meaning as for the builtin open() API.
It defaults to line buffered.
It defaults to -1 which means that the default buffer size will
be used.

The returned wrapped file object provides an extra attribute
.encoding which allows querying the used encoding. This
Expand Down