diff options
author | Robert Collins <rbtcollins@hp.com> | 2015-07-25 18:43:13 (GMT) |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2015-07-25 18:43:13 (GMT) |
commit | c94a1dc4c9a5d23fdb21f6928dd737a59ef3dfb2 (patch) | |
tree | abbbf37e11a6ba307ba00eaa2cf40e27d62d09d2 /Lib/_pyio.py | |
parent | 882667203ca638ffce4238740c521c2a8320be09 (diff) | |
download | cpython-c94a1dc4c9a5d23fdb21f6928dd737a59ef3dfb2.zip cpython-c94a1dc4c9a5d23fdb21f6928dd737a59ef3dfb2.tar.gz cpython-c94a1dc4c9a5d23fdb21f6928dd737a59ef3dfb2.tar.bz2 |
- Issue #2091: error correctly on open() with mode 'U' and '+'
open() accepted a 'U' mode string containing '+', but 'U' can only be used with
'r'. Patch from Jeff Balogh and John O'Connor.
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 50ad9ff..33d8a3f 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -181,8 +181,8 @@ def open(file, mode="r", buffering=-1, encoding=None, errors=None, text = "t" in modes binary = "b" in modes if "U" in modes: - if creating or writing or appending: - raise ValueError("can't use U and writing mode at once") + if creating or writing or appending or updating: + raise ValueError("mode U cannot be combined with 'x', 'w', 'a', or '+'") import warnings warnings.warn("'U' mode is deprecated", DeprecationWarning, 2) |