]> granicus.if.org Git - python/commitdiff
Patch by Ron Adam: Don't use u prefix in unicode error messages
authorWalter Dörwald <walter@livinglogic.de>
Wed, 20 Jun 2007 09:25:34 +0000 (09:25 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Wed, 20 Jun 2007 09:25:34 +0000 (09:25 +0000)
and remove u prefix from some comments in test_codecs.py.

Lib/test/test_codeccallbacks.py
Lib/test/test_codecs.py
Objects/exceptions.c

index 31604ff6db10685c2e2a99c24e26a73eba2722e4..77834c4e48622cd76cfe4d9b6f4b3cbe7f7dbfe1 100644 (file)
@@ -329,7 +329,7 @@ class CodecCallbackTest(unittest.TestCase):
         self.check_exceptionobjectargs(
             UnicodeEncodeError,
             ["ascii", "g\xfcrk", 1, 2, "ouch"],
-            "'ascii' codec can't encode character u'\\xfc' in position 1: ouch"
+            "'ascii' codec can't encode character '\\xfc' in position 1: ouch"
         )
         self.check_exceptionobjectargs(
             UnicodeEncodeError,
@@ -339,23 +339,23 @@ class CodecCallbackTest(unittest.TestCase):
         self.check_exceptionobjectargs(
             UnicodeEncodeError,
             ["ascii", "\xfcx", 0, 1, "ouch"],
-            "'ascii' codec can't encode character u'\\xfc' in position 0: ouch"
+            "'ascii' codec can't encode character '\\xfc' in position 0: ouch"
         )
         self.check_exceptionobjectargs(
             UnicodeEncodeError,
             ["ascii", "\u0100x", 0, 1, "ouch"],
-            "'ascii' codec can't encode character u'\\u0100' in position 0: ouch"
+            "'ascii' codec can't encode character '\\u0100' in position 0: ouch"
         )
         self.check_exceptionobjectargs(
             UnicodeEncodeError,
             ["ascii", "\uffffx", 0, 1, "ouch"],
-            "'ascii' codec can't encode character u'\\uffff' in position 0: ouch"
+            "'ascii' codec can't encode character '\\uffff' in position 0: ouch"
         )
         if sys.maxunicode > 0xffff:
             self.check_exceptionobjectargs(
                 UnicodeEncodeError,
                 ["ascii", "\U00010000x", 0, 1, "ouch"],
-                "'ascii' codec can't encode character u'\\U00010000' in position 0: ouch"
+                "'ascii' codec can't encode character '\\U00010000' in position 0: ouch"
             )
 
     def test_unicodedecodeerror(self):
@@ -374,23 +374,23 @@ class CodecCallbackTest(unittest.TestCase):
         self.check_exceptionobjectargs(
             UnicodeTranslateError,
             ["g\xfcrk", 1, 2, "ouch"],
-            "can't translate character u'\\xfc' in position 1: ouch"
+            "can't translate character '\\xfc' in position 1: ouch"
         )
         self.check_exceptionobjectargs(
             UnicodeTranslateError,
             ["g\u0100rk", 1, 2, "ouch"],
-            "can't translate character u'\\u0100' in position 1: ouch"
+            "can't translate character '\\u0100' in position 1: ouch"
         )
         self.check_exceptionobjectargs(
             UnicodeTranslateError,
             ["g\uffffrk", 1, 2, "ouch"],
-            "can't translate character u'\\uffff' in position 1: ouch"
+            "can't translate character '\\uffff' in position 1: ouch"
         )
         if sys.maxunicode > 0xffff:
             self.check_exceptionobjectargs(
                 UnicodeTranslateError,
                 ["g\U00010000rk", 1, 2, "ouch"],
-                "can't translate character u'\\U00010000' in position 1: ouch"
+                "can't translate character '\\U00010000' in position 1: ouch"
             )
         self.check_exceptionobjectargs(
             UnicodeTranslateError,
index 7a679b691716a2e7dc15cfec6140d6ab930246a5..666f0dff95c0412d4d41b3c20c3c20d1db2c4e17 100644 (file)
@@ -459,10 +459,10 @@ class UTF8SigTest(ReadTest):
                 "",
                 "\ufeff", # Second BOM has been read and emitted
                 "\ufeff\x00", # "\x00" read and emitted
-                "\ufeff\x00", # First byte of encoded u"\xff" read
-                "\ufeff\x00\xff", # Second byte of encoded u"\xff" read
-                "\ufeff\x00\xff", # First byte of encoded u"\u07ff" read
-                "\ufeff\x00\xff\u07ff", # Second byte of encoded u"\u07ff" read
+                "\ufeff\x00", # First byte of encoded "\xff" read
+                "\ufeff\x00\xff", # Second byte of encoded "\xff" read
+                "\ufeff\x00\xff", # First byte of encoded "\u07ff" read
+                "\ufeff\x00\xff\u07ff", # Second byte of encoded "\u07ff" read
                 "\ufeff\x00\xff\u07ff",
                 "\ufeff\x00\xff\u07ff",
                 "\ufeff\x00\xff\u07ff\u0800",
index 8d1ee2a6021bfe3ee6d8c280a6c3b8e52e144b7a..1df0ea0852db27622efad8c2533edc1fbbec8ce4 100644 (file)
@@ -1289,11 +1289,11 @@ UnicodeEncodeError_str(PyObject *self)
         int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start];
         const char *fmt;
         if (badchar <= 0xff)
-            fmt = "'%U' codec can't encode character u'\\x%02x' in position %zd: %U";
+            fmt = "'%U' codec can't encode character '\\x%02x' in position %zd: %U";
         else if (badchar <= 0xffff)
-            fmt = "'%U' codec can't encode character u'\\u%04x' in position %zd: %U";
+            fmt = "'%U' codec can't encode character '\\u%04x' in position %zd: %U";
         else
-            fmt = "'%U' codec can't encode character u'\\U%08x' in position %zd: %U";
+            fmt = "'%U' codec can't encode character '\\U%08x' in position %zd: %U";
         return PyUnicode_FromFormat(
             fmt,
             ((PyUnicodeErrorObject *)self)->encoding,
@@ -1440,11 +1440,11 @@ UnicodeTranslateError_str(PyObject *self)
         int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start];
         const char *fmt;
         if (badchar <= 0xff)
-            fmt = "can't translate character u'\\x%02x' in position %zd: %U";
+            fmt = "can't translate character '\\x%02x' in position %zd: %U";
         else if (badchar <= 0xffff)
-            fmt = "can't translate character u'\\u%04x' in position %zd: %U";
+            fmt = "can't translate character '\\u%04x' in position %zd: %U";
         else
-            fmt = "can't translate character u'\\U%08x' in position %zd: %U";
+            fmt = "can't translate character '\\U%08x' in position %zd: %U";
         return PyUnicode_FromFormat(
             fmt,
             badchar,