diff -r e04eefef7820 Lib/multiprocessing/connection.py --- a/Lib/multiprocessing/connection.py Mon Jun 23 20:14:46 2014 -0700 +++ b/Lib/multiprocessing/connection.py Wed Jun 25 18:45:19 2014 +0300 @@ -454,10 +454,10 @@ return self._loads(s) def _xml_dumps(obj): - return xmlrpclib.dumps((obj,), None, None, None, 1).encode('utf8') + return xmlrpclib.dumps((obj,), None, None, None, 1) def _xml_loads(s): - (obj,), method = xmlrpclib.loads(s.decode('utf8')) + (obj,), method = xmlrpclib.loads(s) return obj class XmlListener(Listener): diff -r e04eefef7820 Lib/multiprocessing/sharedctypes.py --- a/Lib/multiprocessing/sharedctypes.py Mon Jun 23 20:14:46 2014 -0700 +++ b/Lib/multiprocessing/sharedctypes.py Wed Jun 25 18:45:19 2014 +0300 @@ -46,13 +46,18 @@ # typecode_to_type = { - 'c': ctypes.c_char, 'u': ctypes.c_wchar, + 'c': ctypes.c_char, 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, 'h': ctypes.c_short, 'H': ctypes.c_ushort, 'i': ctypes.c_int, 'I': ctypes.c_uint, 'l': ctypes.c_long, 'L': ctypes.c_ulong, 'f': ctypes.c_float, 'd': ctypes.c_double } +try: + typecode_to_type['u'] = ctypes.c_wchar +except AttributeError: + pass + # # diff -r e04eefef7820 Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py Mon Jun 23 20:14:46 2014 -0700 +++ b/Lib/test/test_multiprocessing.py Wed Jun 25 18:45:19 2014 +0300 @@ -1371,6 +1371,15 @@ class _TestRemoteManager(BaseTestCase): ALLOWED_TYPES = ('manager',) + values = ['hello world', None, True, 2.25, + 'hall\xc3\xa5 v\xc3\xa4rlden'] # UTF-8 + result = values[:] + if test_support.have_unicode: + result[-1] = u'hall\xe5 v\xe4rlden' + uvalue = test_support.u(r'\u043f\u0440\u0438\u0432\u0456\u0442 ' + r'\u0441\u0432\u0456\u0442') + values.append(uvalue) + result.append(uvalue) @classmethod def _putter(cls, address, authkey): @@ -1379,7 +1388,8 @@ ) manager.connect() queue = manager.get_queue() - queue.put(('hello world', None, True, 2.25)) + # Note that xmlrpclib will deserialize object as a list not a tuple + queue.put(tuple(cls.values)) def test_remote(self): authkey = os.urandom(32) @@ -1399,8 +1409,7 @@ manager2.connect() queue = manager2.get_queue() - # Note that xmlrpclib will deserialize object as a list not a tuple - self.assertEqual(queue.get(), ['hello world', None, True, 2.25]) + self.assertEqual(queue.get(), self.result) # Because we are using xmlrpclib for serialization instead of # pickle this will cause a serialization error. @@ -2392,12 +2401,12 @@ name = os.path.join(os.path.dirname(__file__), 'mp_fork_bomb.py') if WIN32: rc, out, err = test.script_helper.assert_python_failure(name) - self.assertEqual('', out.decode('ascii')) - self.assertIn('RuntimeError', err.decode('ascii')) + self.assertEqual('', out) + self.assertIn('RuntimeError', err) else: rc, out, err = test.script_helper.assert_python_ok(name) - self.assertEqual('123', out.decode('ascii').rstrip()) - self.assertEqual('', err.decode('ascii')) + self.assertEqual('123', out.rstrip()) + self.assertEqual('', err) # # Issue 12098: check sys.flags of child matches that for parent @@ -2421,6 +2430,7 @@ flags = (tuple(sys.flags), grandchild_flags) print(json.dumps(flags)) + @test_support.requires_unicode # XXX json needs unicode support def test_flags(self): import json, subprocess # start child process using unusual flags