mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
python-gdb.py: Replace invalid Unicode character with U+FFFD to be able to
display invalid strings. Such strings can be found while Python is creating a new string, in a text decoder for example, when Python is compiled in debug mode.
This commit is contained in:
parent
dc040f099d
commit
d8a5cc91e6
1 changed files with 3 additions and 1 deletions
|
@ -1160,7 +1160,9 @@ class PyUnicodeObjectPtr(PyObjectPtr):
|
|||
# Convert the int code points to unicode characters, and generate a
|
||||
# local unicode instance.
|
||||
# This splits surrogate pairs if sizeof(Py_UNICODE) is 2 here (in gdb).
|
||||
result = u''.join([_unichr(ucs) for ucs in Py_UNICODEs])
|
||||
result = u''.join([
|
||||
(_unichr(ucs) if ucs <= 0x10ffff else '\ufffd')
|
||||
for ucs in Py_UNICODEs])
|
||||
return result
|
||||
|
||||
def write_repr(self, out, visited):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue