mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #15204: Deprecated the 'U' mode in file-like objects.
This commit is contained in:
parent
d41c343f28
commit
6787a3806e
13 changed files with 45 additions and 13 deletions
|
|
@ -1117,6 +1117,10 @@ class ZipFile:
|
|||
"""Return file-like object for 'name'."""
|
||||
if mode not in ("r", "U", "rU"):
|
||||
raise RuntimeError('open() requires mode "r", "U", or "rU"')
|
||||
if 'U' in mode:
|
||||
import warnings
|
||||
warnings.warn("'U' mode is deprecated",
|
||||
DeprecationWarning, 2)
|
||||
if pwd and not isinstance(pwd, bytes):
|
||||
raise TypeError("pwd: expected bytes, got %s" % type(pwd))
|
||||
if not self.fp:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue