summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_unicode.py5
-rw-r--r--Objects/unicodeobject.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index b859fbb..c701e44 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -362,10 +362,7 @@ if sys.platform[:4] != 'java':
verify(u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"} == u'abc, def')
try:
- if sys.platform[:4] != 'java':
- value = u"%(x)s, %(ä)s" % {'x':u"abc", u'ä'.encode('utf-8'):"def"}
- else:
- value = u"%(x)s, %(ä)s" % {'x':u"abc", u'ä':"def"}
+ value = u"%(x)s, %(ä)s" % {'x':u"abc", u'ä':"def"}
except KeyError:
print '*** formatting failed for "%s"' % "u'abc, def'"
else:
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 57ef62a..1420455 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5300,6 +5300,7 @@ PyObject *PyUnicode_Format(PyObject *format,
"incomplete format key");
goto onError;
}
+#if 0
/* keys are converted to strings using UTF-8 and
then looked up since Python uses strings to hold
variables names etc. in its namespaces and we
@@ -5307,6 +5308,9 @@ PyObject *PyUnicode_Format(PyObject *format,
key = PyUnicode_EncodeUTF8(keystart,
keylen,
NULL);
+#else
+ key = PyUnicode_FromUnicode(keystart, keylen);
+#endif
if (key == NULL)
goto onError;
if (args_owned) {