Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_gdb: test_strings() fails with ASCII locale #52805

Closed
vstinner opened this issue Apr 28, 2010 · 5 comments
Closed

test_gdb: test_strings() fails with ASCII locale #52805

vstinner opened this issue Apr 28, 2010 · 5 comments
Labels
tests Tests in the Lib/test dir topic-unicode

Comments

@vstinner
Copy link
Member

BPO 8559
Nosy @loewis, @vstinner, @davidmalcolm
Files
  • test_gdb_unicode-2.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2010-05-20.11:33:15.079>
    created_at = <Date 2010-04-28.13:58:58.113>
    labels = ['tests', 'expert-unicode']
    title = 'test_gdb: test_strings() fails with ASCII locale'
    updated_at = <Date 2010-05-20.11:33:15.078>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2010-05-20.11:33:15.078>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2010-05-20.11:33:15.079>
    closer = 'vstinner'
    components = ['Tests', 'Unicode']
    creation = <Date 2010-04-28.13:58:58.113>
    creator = 'vstinner'
    dependencies = []
    files = ['17140']
    hgrepos = []
    issue_num = 8559
    keywords = ['patch']
    message_count = 5.0
    messages = ['104431', '104604', '104605', '106115', '106138']
    nosy_count = 3.0
    nosy_names = ['loewis', 'vstinner', 'dmalcolm']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue8559'
    versions = ['Python 3.2']

    @vstinner
    Copy link
    Member Author

    http://www.python.org/dev/buildbot/builders/alpha Debian 3.x/builds/67/steps/test/logs/stdio

    ======================================================================
    ERROR: test_strings (test.test_gdb.PrettyPrintTests)
    Verify the pretty-printing of unicode strings
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/doko/buildarea/3.x.klose-debian-alpha/build/Lib/test/test_gdb.py", line 230, in test_strings
        self.assertGdbRepr('\u2620')
      File "/home/doko/buildarea/3.x.klose-debian-alpha/build/Lib/test/test_gdb.py", line 176, in assertGdbRepr
        cmds_after_breakpoint)
      File "/home/doko/buildarea/3.x.klose-debian-alpha/build/Lib/test/test_gdb.py", line 144, in get_gdb_repr
        import_site=import_site)
      File "/home/doko/buildarea/3.x.klose-debian-alpha/build/Lib/test/test_gdb.py", line 120, in get_stack_trace
        out, err = self.run_gdb(*args)
      File "/home/doko/buildarea/3.x.klose-debian-alpha/build/Lib/test/test_gdb.py", line 60, in run_gdb
        args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
      File "/home/doko/buildarea/3.x.klose-debian-alpha/build/Lib/subprocess.py", line 670, in __init__
        restore_signals, start_new_session)
      File "/home/doko/buildarea/3.x.klose-debian-alpha/build/Lib/subprocess.py", line 1115, in _execute_child
        restore_signals, start_new_session, preexec_fn)
    UnicodeEncodeError: 'ascii' codec can't encode character '\u2620' in position 4: ordinal not in range(128)

    You can try with: "LANG= ./python Lib/test/regrtest.py test_gdb".

    We should skip the test if '\u2620' is not encodable to sys.getfileystemencoding(), or maybe use '\\u2620'.

    @vstinner vstinner added tests Tests in the Lib/test dir topic-unicode labels Apr 28, 2010
    @vstinner
    Copy link
    Member Author

    Patch using raw string instead of the unicode character directly to avoid the locale issue. I'm not sure that we really test unicode support of the gdb library using my patch.

    I also get another error: << AssertionError: "'\\\\U0001D121'" did not equal expected "'\\U0000d834\\U0000dd21'" >>. The problem is that test_gdb tests sys.maxunicode whereas gdb may use a different Python library (eg. Python2 whereas we are using Python3) not using the same unicode option (narrow vs wide unicode). The test should ask gdb for its sys.maxunicode value.

    @vstinner
    Copy link
    Member Author

    The test should ask gdb for its sys.maxunicode value.

    Ok, done in a new version of the patch.

    test_gdb now pass with and without locale (utf8 and ascii).

    The patch is for py3k. test_gdb in Python trunk doesn't test has the unicode tests in test_strings() function.

    @vstinner
    Copy link
    Member Author

    r81375 improves unicode support of libpython.py. I hope that it will be enough to fix test_strings() failures.

    @vstinner
    Copy link
    Member Author

    r81375 improves unicode support of libpython.py. I hope that it will be
    enough to fix test_strings() failures.

    Ok, buildbots seem happy: "alpha Debian 3.x" is green again.

    Python 3.1 doesn't have libpython.py: commit blocked (r81376).

    I forward ported some code from py3k to trunk to fix support of non-BMP unicode characters: r81377. Commit blocked in py3k (r81378) and 2.6 (r81379).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir topic-unicode
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant