Author: Amaury Forgeot d'Arc <amaur...@gmail.com>
Branch: py3.6
Changeset: r93370:e0f1b581e68d
Date: 2017-12-11 12:01 +0100
http://bitbucket.org/pypy/pypy/changeset/e0f1b581e68d/

Log:    Python 3.6 is more strict with deprecated files like 'U+'

diff --git a/pypy/module/_io/interp_io.py b/pypy/module/_io/interp_io.py
--- a/pypy/module/_io/interp_io.py
+++ b/pypy/module/_io/interp_io.py
@@ -68,9 +68,9 @@
         rawmode += "+"
 
     if universal:
-        if writing or appending:
+        if writing or appending or creating or updating:
             raise oefmt(space.w_ValueError,
-                        "can't use U and writing mode at once")
+                        "mode U cannot be combined with 'x', 'w', 'a', or '+'")
         space.warn(space.newtext("'U' mode is deprecated ('r' has the same "
                               "effect in Python 3.x)"),
                    space.w_DeprecationWarning)
diff --git a/pypy/module/_io/test/test_io.py b/pypy/module/_io/test/test_io.py
--- a/pypy/module/_io/test/test_io.py
+++ b/pypy/module/_io/test/test_io.py
@@ -210,6 +210,8 @@
         raises(ValueError, io.open, self.tmpfile, "ww")
         raises(ValueError, io.open, self.tmpfile, "rwa")
         raises(ValueError, io.open, self.tmpfile, "b", newline="\n")
+        raises(ValueError, io.open, self.tmpfile, "U+")
+        raises(ValueError, io.open, self.tmpfile, "xU")
 
     def test_array_write(self):
         import _io, array
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to