From 5962f457b48997dbfb8bcb0769b57cd3fab96148 Mon Sep 17 00:00:00 2001 From: "Andrew M. Kuchling" Date: Sat, 5 Jun 2004 12:35:58 +0000 Subject: [Bug #841757] Patch from /F to allow Unicode strings as struct keys --- Lib/xmlrpclib.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/xmlrpclib.py b/Lib/xmlrpclib.py index 2466e25..e7eb466 100644 --- a/Lib/xmlrpclib.py +++ b/Lib/xmlrpclib.py @@ -688,12 +688,15 @@ class Marshaller: self.memo[i] = None dump = self.__dump write("\n") - for k in value.keys(): + for k, v in value.items(): write("\n") if type(k) is not StringType: - raise TypeError, "dictionary key must be string" + if unicode and type(k) is UnicodeType: + k = k.encode(self.encoding) + else: + raise TypeError, "dictionary key must be string" write("%s\n" % escape(k)) - dump(value[k], write) + dump(v, write) write("\n") write("\n") del self.memo[i] -- cgit v0.12