Skip to content

Commit cec8cd7

Browse files
author
Alexey Izbyshev
committed
Update docs for codecs.open()
1 parent aff54cf commit cec8cd7

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/library/codecs.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ recommended approach for working with encoded text files, this module
174174
provides additional utility functions and classes that allow the use of a
175175
wider range of codecs when working with binary files:
176176

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

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

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

200200

201201
.. function:: EncodedFile(file, data_encoding, file_encoding=None, errors='strict')

Lib/codecs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,8 @@ def open(filename, mode='r', encoding=None, errors='strict', buffering=-1):
883883
encoding error occurs.
884884
885885
buffering has the same meaning as for the builtin open() API.
886-
It defaults to line buffered.
886+
It defaults to -1 which means that the default buffer size will
887+
be used.
887888
888889
The returned wrapped file object provides an extra attribute
889890
.encoding which allows querying the used encoding. This

0 commit comments

Comments
 (0)