Patch by Ron Adam: Don't use u prefix in unicode error messages
and remove u prefix from some comments in test_codecs.py.
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 8d1ee2a..1df0ea0 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -1289,11 +1289,11 @@
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 @@
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,