diff -r 0eedac3d0b0a Lib/test/test_tcl.py --- a/Lib/test/test_tcl.py Thu May 29 01:46:48 2014 -0400 +++ b/Lib/test/test_tcl.py Thu May 29 17:04:27 2014 +0300 @@ -345,8 +345,10 @@ self.assertEqual(passValue('str\x00ing'), 'str\x00ing') self.assertEqual(passValue('str\x00ing\xbd'), 'str\x00ing\xbd') self.assertEqual(passValue('str\x00ing\u20ac'), 'str\x00ing\u20ac') - self.assertEqual(passValue(b'str\x00ing'), 'str\x00ing') - self.assertEqual(passValue(b'str\xc0\x80ing'), 'str\x00ing') + self.assertEqual(passValue(b'str\x00ing'), + b'str\x00ing' if self.wantobjects else 'str\x00ing') + self.assertEqual(passValue(b'str\xc0\x80ing'), + b'str\xc0\x80ing' if self.wantobjects else 'str\xc0\x80ing') for i in (0, 1, -1, 2**31-1, -2**31): self.assertEqual(passValue(i), i if self.wantobjects else str(i)) for f in (0.0, 1.0, -1.0, 1/3, @@ -399,12 +401,13 @@ check('string\xbd', 'string\xbd') check('string\u20ac', 'string\u20ac') check(b'string', 'string') - check(b'string\xe2\x82\xac', 'string\u20ac') + check(b'string\xe2\x82\xac', 'string\xe2\x82\xac') check('str\x00ing', 'str\x00ing') check('str\x00ing\xbd', 'str\x00ing\xbd') check('str\x00ing\u20ac', 'str\x00ing\u20ac') - check(b'str\xc0\x80ing', 'str\x00ing') - check(b'str\xc0\x80ing\xe2\x82\xac', 'str\x00ing\u20ac') + check(b'str\x00ing', 'str\x00ing') + check(b'str\xc0\x80ing', 'str\xc0\x80ing') + check(b'str\xc0\x80ing\xe2\x82\xac', 'str\xc0\x80ing\xe2\x82\xac') for i in (0, 1, -1, 2**31-1, -2**31): check(i, str(i)) for f in (0.0, 1.0, -1.0): @@ -452,9 +455,9 @@ if tcl_version >= (8, 5): if not self.wantobjects or get_tk_patchlevel() < (8, 5, 5): # Before 8.5.5 dicts were converted to lists through string - expected = ('12', '\u20ac', '\u20ac', '3.4') + expected = ('12', '\u20ac', '\xe2\x82\xac', '3.4') else: - expected = (12, '\u20ac', '\u20ac', (3.4,)) + expected = (12, '\u20ac', b'\xe2\x82\xac', (3.4,)) testcases += [ (call('dict', 'create', 12, '\u20ac', b'\xe2\x82\xac', (3.4,)), expected), @@ -502,9 +505,9 @@ if tcl_version >= (8, 5): if not self.wantobjects or get_tk_patchlevel() < (8, 5, 5): # Before 8.5.5 dicts were converted to lists through string - expected = ('12', '\u20ac', '\u20ac', '3.4') + expected = ('12', '\u20ac', '\xe2\x82\xac', '3.4') else: - expected = (12, '\u20ac', '\u20ac', (3.4,)) + expected = (12, '\u20ac', b'\xe2\x82\xac', (3.4,)) testcases += [ (call('dict', 'create', 12, '\u20ac', b'\xe2\x82\xac', (3.4,)), expected), diff -r 0eedac3d0b0a Modules/_tkinter.c --- a/Modules/_tkinter.c Thu May 29 01:46:48 2014 -0400 +++ b/Modules/_tkinter.c Thu May 29 17:04:27 2014 +0300 @@ -889,8 +889,8 @@ int overflow; if (PyBytes_Check(value)) - return Tcl_NewStringObj(PyBytes_AS_STRING(value), - PyBytes_GET_SIZE(value)); + return Tcl_NewByteArrayObj((unsigned char *)PyBytes_AS_STRING(value), + PyBytes_GET_SIZE(value)); else if (PyBool_Check(value)) return Tcl_NewBooleanObj(PyObject_IsTrue(value)); else if (PyLong_CheckExact(value) &&