Index: Tools/gdb/libpython.py =================================================================== --- Tools/gdb/libpython.py (revision 82626) +++ Tools/gdb/libpython.py (working copy) @@ -1035,8 +1035,9 @@ def write_repr(self, out, visited): proxy = self.proxyval(visited) - if self.char_width() == 2: - # sizeof(Py_UNICODE)==2: join surrogates + if self.char_width() == 2 and sys.maxunicode == 0x10ffff: + # sizeof(Py_UNICODE) is 2 in the inferior process and 4 in the gdb + # process: join surrogates proxy2 = [] i = 0 while i < len(proxy):