[Python-checkins] cpython: Issue #21118: str.translate() now raises a ValueError, not a TypeError, if the

victor.stinner python-checkins at python.org
Sat Apr 5 15:35:20 CEST 2014


http://hg.python.org/cpython/rev/e56c71c6b45e
changeset:   90158:e56c71c6b45e
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Apr 05 15:35:01 2014 +0200
summary:
  Issue #21118: str.translate() now raises a ValueError, not a TypeError, if the
replacement character is bigger than U+10ffff code point.

files:
  Lib/test/test_codeccallbacks.py |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_codeccallbacks.py b/Lib/test/test_codeccallbacks.py
--- a/Lib/test/test_codeccallbacks.py
+++ b/Lib/test/test_codeccallbacks.py
@@ -819,7 +819,7 @@
             def __getitem__(self, key):
                 raise ValueError
         #self.assertRaises(ValueError, "\xff".translate, D())
-        self.assertRaises(TypeError, "\xff".translate, {0xff: sys.maxunicode+1})
+        self.assertRaises(ValueError, "\xff".translate, {0xff: sys.maxunicode+1})
         self.assertRaises(TypeError, "\xff".translate, {0xff: ()})
 
     def test_bug828737(self):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list