@@ -94,10 +94,7 @@ mode. Other common values are 'w' for writing (truncating the file if
9494it already exists), 'x' for creating and writing to a new file, and
9595'a' for appending (which on some Unix systems, means that all writes
9696append to the end of the file regardless of the current seek position).
97- In text mode, if encoding is not specified the encoding used is platform
98- dependent: locale.getencoding() is called to get the current locale
99- encoding. (For reading and writing raw bytes use binary mode and leave
100- encoding unspecified.) The available modes are:
97+ The available modes are:
10198
10299========= ==========================================================
103100Character Meaning
@@ -122,8 +119,7 @@ even when the underlying operating system doesn't. Files opened in
122119binary mode (appending 'b' to the mode argument) return contents as
123120bytes objects without any decoding. In text mode (the default, or when
124121't' is appended to the mode argument), the contents of the file are
125- returned as strings, the bytes having been first decoded using a
126- platform-dependent encoding or using the specified encoding if given.
122+ decoded using the encoding described below and returned as strings.
127123
128124buffering is an optional integer used to set the buffering policy.
129125Pass 0 to switch buffering off (only allowed in binary mode), 1 to
@@ -140,10 +136,11 @@ argument is given, the default buffering policy works as follows:
140136 use line buffering. Other text files use the policy described above
141137 for binary files.
142138
143- encoding is the name of the encoding used to decode or encode the
144- file. This should only be used in text mode. The default encoding is
145- platform dependent, but any encoding supported by Python can be
146- passed. See the codecs module for the list of supported encodings.
139+ encoding is the name of the encoding used to decode or encode the file.
140+ This should only be used in text mode. The default encoding is UTF-8;
141+ if UTF-8 Mode is disabled, the encoding returned by
142+ locale.getencoding() is used instead. See the codecs module for the
143+ list of supported encodings.
147144
148145errors is an optional string that specifies how encoding errors are to
149146be handled---this argument should not be used in binary mode. Pass
@@ -200,7 +197,7 @@ static PyObject *
200197_io_open_impl (PyObject * module , PyObject * file , const char * mode ,
201198 int buffering , const char * encoding , const char * errors ,
202199 const char * newline , int closefd , PyObject * opener )
203- /*[clinic end generated code: output=aefafc4ce2b46dc0 input=b3cefa70bef404b3 ]*/
200+ /*[clinic end generated code: output=aefafc4ce2b46dc0 input=5a005681afa02242 ]*/
204201{
205202 size_t i ;
206203
0 commit comments