[New-bugs-announce] [issue8495] test_gdb: use utf8+surrogateescape charset?

STINNER Victor report at bugs.python.org
Thu Apr 22 02:43:07 CEST 2010


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

Because of a strange bug, gdb writes random bytes to stdout. test_gdb decodes output as utf8, but these random bytes cause a UnicodeDecodeError:

ERROR: test_int (__main__.PrettyPrintTests)
Verify the pretty-printing of various "int"/long values
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_gdb.py", line 188, in test_int
    self.assertGdbRepr(1000000000000)
  File "Lib/test/test_gdb.py", line 176, in assertGdbRepr
    cmds_after_breakpoint)
  File "Lib/test/test_gdb.py", line 144, in get_gdb_repr
    import_site=import_site)
  File "Lib/test/test_gdb.py", line 120, in get_stack_trace
    out, err = self.run_gdb(*args)
  File "Lib/test/test_gdb.py", line 62, in run_gdb
    return out.decode('utf-8'), err.decode('utf-8')
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 1882-1887: unsupported Unicode code range

surrogateescape should be used the invalid sequence using surrogates.

---

See attached file for the strange gdb bug.

command is the byte string "id(1000000000000)\n\0" (19 bytes, strlen=18), but gdb prints bytes after the \0. Stranger: print (*command)@15 does also prints these random bytes, whereas print (*command)@14 doesn't.

----------
components: Tests
files: gdb_bug.txt
messages: 103929
nosy: haypo
severity: normal
status: open
title: test_gdb: use utf8+surrogateescape charset?
versions: Python 3.2
Added file: http://bugs.python.org/file17038/gdb_bug.txt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8495>
_______________________________________


More information about the New-bugs-announce mailing list