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.support.FS_NONASCII returns incorrect result in Windows with non-US locale #77890

Closed
native-api mannequin opened this issue May 31, 2018 · 7 comments
Closed

test.support.FS_NONASCII returns incorrect result in Windows with non-US locale #77890

native-api mannequin opened this issue May 31, 2018 · 7 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@native-api
Copy link
Mannequin

native-api mannequin commented May 31, 2018

BPO 33709
Nosy @vstinner, @serhiy-storchaka, @native-api, @miss-islington
PRs
  • bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252 #7278
  • [2.7] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252 (GH-7278) #7279
  • [3.7] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) #10981
  • [3.6] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) #10982
  • 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 2018-12-06.09:52:10.771>
    created_at = <Date 2018-05-31.08:54:10.044>
    labels = ['3.7', '3.8', 'type-bug', 'tests']
    title = 'test.support.FS_NONASCII returns incorrect result in Windows with non-US locale'
    updated_at = <Date 2018-12-06.09:52:10.770>
    user = 'https://github.com/native-api'

    bugs.python.org fields:

    activity = <Date 2018-12-06.09:52:10.770>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-12-06.09:52:10.771>
    closer = 'serhiy.storchaka'
    components = ['Tests']
    creation = <Date 2018-05-31.08:54:10.044>
    creator = 'Ivan.Pozdeev'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33709
    keywords = ['patch']
    message_count = 7.0
    messages = ['318271', '318308', '318481', '331207', '331208', '331209', '331217']
    nosy_count = 4.0
    nosy_names = ['vstinner', 'serhiy.storchaka', 'Ivan.Pozdeev', 'miss-islington']
    pr_nums = ['7278', '7279', '10981', '10982']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33709'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @native-api
    Copy link
    Mannequin Author

    native-api mannequin commented May 31, 2018

    This causes test_ntpath and test_posixpath to fail in subj.

    Sample failure:

    ======================================================================
    FAIL: test_expandvars_nonascii (main.NtCommonTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "c:\Users\Sasha\Documents\cpython\lib\test\test_genericpath.py", line 230
    , in test_expandvars_nonascii
        check(u'$spam bar', u'%s bar' % unonascii)
      File "c:\Users\Sasha\Documents\cpython\lib\test\test_genericpath.py", line 214
    , in check
        self.assertEqual(expandvars(value), expected)
    AssertionError: u'? bar' != u'\xe6 bar'
    - ? bar
    ? ^
    + \xe6 bar
    ? ^

    Cause:

    if sys.getfilesystemencoding()=='mbcs', encoding Unicode characters that are missing in the current locale succeeds but produces '?'.

    So, test.support.FS_NONASCII's test fails to detect if a character is present in the current locale.

    @native-api native-api mannequin added 3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels May 31, 2018
    @vstinner
    Copy link
    Member

    FAIL: test_expandvars_nonascii (main.NtCommonTest)

    What is your Python version?

    Python uses UTF-8 to encode paths on Windows since Python 3.6:
    https://vstinner.github.io/python36-utf8-windows.html

    @native-api
    Copy link
    Mannequin Author

    native-api mannequin commented Jun 2, 2018

    In 3.x, it turns out, this doesn't result in test failures in stock configuration.

    It does though if PYTHONLEGACYWINDOWSFSENCODING is in system environment.

    I was diagnosing failures in 2.x and saw that 3.x has the same logic, so it was a no-brainer to replicate the change...

    @serhiy-storchaka
    Copy link
    Member

    New changeset 8752dfb by Serhiy Storchaka (native-api) in branch 'master':
    bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)
    8752dfb

    @miss-islington
    Copy link
    Contributor

    New changeset b1438c0 by Miss Islington (bot) in branch '3.7':
    bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)
    b1438c0

    @miss-islington
    Copy link
    Contributor

    New changeset af31228 by Miss Islington (bot) in branch '3.6':
    bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)
    af31228

    @serhiy-storchaka
    Copy link
    Member

    New changeset 29a4cbf by Serhiy Storchaka (native-api) in branch '2.7':
    [2.7] bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278) (GH-7279)
    29a4cbf

    @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
    3.7 (EOL) end of life 3.8 only security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants