This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_gdb fails with LC_ALL=C
Type: Stage: resolved
Components: Tests, Unicode Versions: Python 3.8, Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, miss-islington, vstinner
Priority: normal Keywords: patch

Created on 2018-08-28 20:05 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 9483 merged Elvis.Pranskevichus, 2018-09-21 21:34
PR 9485 merged miss-islington, 2018-09-22 01:13
Messages (5)
msg324284 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-08-28 20:05
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 <>
    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:
    Find the GDB manual and other documentation resources online at:
    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/", line 331, in test_strings
  File "/home/vstinner/prog/python/3.7/Lib/test/", line 323, in check_repr
  File "/home/vstinner/prog/python/3.7/Lib/test/", 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/".

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:

Total duration: 1 sec 422 ms
Tests result: FAILURE
msg326059 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-22 01:13
New changeset 7279b5125e7c5d84a473d250b27d353cb7f6628e by Victor Stinner (Elvis Pranskevichus) in branch 'master':
bpo-34537: Fix test_gdb:test_strings with LC_ALL=C (GH-9483)
msg326060 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-22 01:15
I don't think that it's worth it to backport the change to Python 3.6 and older, since "LC_ALL=C ./python -m test test_gdb" already pass on 2.7 and 3.6.
msg326062 - (view) Author: miss-islington (miss-islington) Date: 2018-09-22 01:29
New changeset e5fde1f992e94f166415ab96d874ed1d2e0c8004 by Miss Islington (bot) in branch '3.7':
bpo-34537: Fix test_gdb:test_strings with LC_ALL=C (GH-9483)
msg326080 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-22 07:27
Thank you Elvis for the fix!
Date User Action Args
2022-04-11 14:59:05adminsetgithub: 78718
2018-09-24 15:07:02vstinnersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-09-22 07:27:41vstinnersetmessages: + msg326080
2018-09-22 01:29:40miss-islingtonsetnosy: + miss-islington
messages: + msg326062
2018-09-22 01:15:00vstinnersetmessages: + msg326060
2018-09-22 01:13:30miss-islingtonsetpull_requests: + pull_request8895
2018-09-22 01:13:24vstinnersetmessages: + msg326059
2018-09-21 21:34:26Elvis.Pranskevichussetkeywords: + patch
stage: patch review
pull_requests: + pull_request8893
2018-08-28 20:05:29vstinnercreate