@@ -138,7 +138,6 @@ Character Meaning
138
138
'b' binary mode
139
139
't' text mode (default)
140
140
'+' open a disk file for updating (reading and writing)
141
- 'U' universal newline mode (deprecated)
142
141
========= ===============================================================
143
142
144
143
The default mode is 'rt' (open for reading text). For binary random
@@ -154,10 +153,6 @@ bytes objects without any decoding. In text mode (the default, or when
154
153
returned as strings, the bytes having been first decoded using a
155
154
platform-dependent encoding or using the specified encoding if given.
156
155
157
- 'U' mode is deprecated and will raise an exception in future versions
158
- of Python. It has no effect in Python 3. Use newline to control
159
- universal newlines mode.
160
-
161
156
buffering is an optional integer used to set the buffering policy.
162
157
Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
163
158
line buffering (only usable in text mode), and an integer > 1 to indicate
@@ -233,12 +228,12 @@ static PyObject *
233
228
_io_open_impl (PyObject * module , PyObject * file , const char * mode ,
234
229
int buffering , const char * encoding , const char * errors ,
235
230
const char * newline , int closefd , PyObject * opener )
236
- /*[clinic end generated code: output=aefafc4ce2b46dc0 input=7295902222e6b311 ]*/
231
+ /*[clinic end generated code: output=aefafc4ce2b46dc0 input=1543f4511d2356a5 ]*/
237
232
{
238
233
unsigned i ;
239
234
240
235
int creating = 0 , reading = 0 , writing = 0 , appending = 0 , updating = 0 ;
241
- int text = 0 , binary = 0 , universal = 0 ;
236
+ int text = 0 , binary = 0 ;
242
237
243
238
char rawmode [6 ], * m ;
244
239
int line_buffering , is_number ;
@@ -296,10 +291,6 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
296
291
case 'b' :
297
292
binary = 1 ;
298
293
break ;
299
- case 'U' :
300
- universal = 1 ;
301
- reading = 1 ;
302
- break ;
303
294
default :
304
295
goto invalid_mode ;
305
296
}
@@ -322,18 +313,6 @@ _io_open_impl(PyObject *module, PyObject *file, const char *mode,
322
313
* m = '\0' ;
323
314
324
315
/* Parameters validation */
325
- if (universal ) {
326
- if (creating || writing || appending || updating ) {
327
- PyErr_SetString (PyExc_ValueError ,
328
- "mode U cannot be combined with 'x', 'w', 'a', or '+'" );
329
- goto error ;
330
- }
331
- if (PyErr_WarnEx (PyExc_DeprecationWarning ,
332
- "'U' mode is deprecated" , 1 ) < 0 )
333
- goto error ;
334
- reading = 1 ;
335
- }
336
-
337
316
if (text && binary ) {
338
317
PyErr_SetString (PyExc_ValueError ,
339
318
"can't have text and binary mode at once" );
0 commit comments