@@ -71,7 +71,6 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None,
7171 'b' binary mode
7272 't' text mode (default)
7373 '+' open a disk file for updating (reading and writing)
74- 'U' universal newline mode (deprecated)
7574 ========= ===============================================================
7675
7776 The default mode is 'rt' (open for reading text). For binary random
@@ -87,10 +86,6 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None,
8786 returned as strings, the bytes having been first decoded using a
8887 platform-dependent encoding or using the specified encoding if given.
8988
90- 'U' mode is deprecated and will raise an exception in future versions
91- of Python. It has no effect in Python 3. Use newline to control
92- universal newlines mode.
93-
9489 buffering is an optional integer used to set the buffering policy.
9590 Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
9691 line buffering (only usable in text mode), and an integer > 1 to indicate
@@ -176,7 +171,7 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None,
176171 if errors is not None and not isinstance (errors , str ):
177172 raise TypeError ("invalid errors: %r" % errors )
178173 modes = set (mode )
179- if modes - set ("axrwb+tU " ) or len (mode ) > len (modes ):
174+ if modes - set ("axrwb+t " ) or len (mode ) > len (modes ):
180175 raise ValueError ("invalid mode: %r" % mode )
181176 creating = "x" in modes
182177 reading = "r" in modes
@@ -185,13 +180,6 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None,
185180 updating = "+" in modes
186181 text = "t" in modes
187182 binary = "b" in modes
188- if "U" in modes :
189- if creating or writing or appending or updating :
190- raise ValueError ("mode U cannot be combined with 'x', 'w', 'a', or '+'" )
191- import warnings
192- warnings .warn ("'U' mode is deprecated" ,
193- DeprecationWarning , 2 )
194- reading = True
195183 if text and binary :
196184 raise ValueError ("can't have text and binary mode at once" )
197185 if creating + reading + writing + appending > 1 :
0 commit comments