Issue 34537: test_gdb fails with LC_ALL=C (original) (raw)
On Python 3.7 and master, test_strings() of test_gdb fails if gdb uses Python 3.6 (before UTF-8 Mode and C locale coercion):
- gdb uses ASCII encoding for stdout
- tested Python uses UTF-8 thanks to the UTF-8 Mode and/or C locale coercion
vstinner@apu$ LC_ALL=C ./python -m test -v test_gdb -m test_strings == CPython 3.7.0+ (heads/3.7:65ef7425a3, Aug 28 2018, 16:29:30) [GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] == Linux-4.17.6-200.fc28.x86_64-x86_64-with-fedora-28-Twenty_Eight little-endian == cwd: /home/vstinner/prog/python/3.7/build/test_python_21689 == CPU count: 8 == encodings: locale=UTF-8, FS=utf-8 Run tests sequentially 0:00:00 load avg: 0.35 [1/1] test_gdb GDB version 8.1: GNU gdb (GDB) Fedora 8.1.1-3.fc28 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". test_strings (test.test_gdb.PrettyPrintTests) Verify the pretty-printing of unicode strings ... FAIL
====================================================================== FAIL: test_strings (test.test_gdb.PrettyPrintTests) Verify the pretty-printing of unicode strings
Traceback (most recent call last): File "/home/vstinner/prog/python/3.7/Lib/test/test_gdb.py", line 331, in test_strings check_repr('\u2620') File "/home/vstinner/prog/python/3.7/Lib/test/test_gdb.py", line 323, in check_repr self.assertGdbRepr(text) File "/home/vstinner/prog/python/3.7/Lib/test/test_gdb.py", line 271, in assertGdbRepr % (gdb_repr, exp_repr, gdb_output))) AssertionError: "'\u2620'" != "'☠'"
- '\u2620'
- '☠' : "'\u2620'" did not equal expected "'☠'"; full output was: Breakpoint 1 at 0x52fc1b: file Python/bltinmodule.c, line 1216. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1, builtin_id (self=, v='\u2620') at Python/bltinmodule.c:1216 1216 return PyLong_FromVoidPtr(v); #0 builtin_id (self=, v='\u2620') at Python/bltinmodule.c:1216
Ran 1 test in 1.030s
FAILED (failures=1) test test_gdb failed test_gdb failed
== Tests result: FAILURE ==
1 test failed: test_gdb
Total duration: 1 sec 422 ms Tests result: FAILURE