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

wcscoll is broken on Android and test_locale fails #73182

Closed
xdegaye mannequin opened this issue Dec 17, 2016 · 5 comments
Closed

wcscoll is broken on Android and test_locale fails #73182

xdegaye mannequin opened this issue Dec 17, 2016 · 5 comments
Assignees
Labels
3.7 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented Dec 17, 2016

BPO 28996
Nosy @xdegaye, @yan12125
Files
  • test_locale_strcoll.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 = 'https://github.com/xdegaye'
    closed_at = <Date 2016-12-19.10:16:19.749>
    created_at = <Date 2016-12-17.08:35:18.014>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'wcscoll is broken on Android and test_locale fails'
    updated_at = <Date 2016-12-19.10:16:19.748>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2016-12-19.10:16:19.748>
    actor = 'xdegaye'
    assignee = 'xdegaye'
    closed = True
    closed_date = <Date 2016-12-19.10:16:19.749>
    closer = 'xdegaye'
    components = ['Tests']
    creation = <Date 2016-12-17.08:35:18.014>
    creator = 'xdegaye'
    dependencies = []
    files = ['45942']
    hgrepos = []
    issue_num = 28996
    keywords = ['patch']
    message_count = 5.0
    messages = ['283474', '283496', '283497', '283500', '283598']
    nosy_count = 3.0
    nosy_names = ['xdegaye', 'python-dev', 'yan12125']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue28996'
    versions = ['Python 3.6', 'Python 3.7']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Dec 17, 2016

    These failures happen now that bpo-28596 has been fixed and that locale.getpreferredencoding(False) returns 'UTF-8'.

    ======================================================================
    FAIL: test_strcoll_with_diacritic (test.test_locale.TestEnUSCollation)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_locale.py", line 362, in test_strcoll_with_diacritic
        self.assertLess(locale.strcoll('à', 'b'), 0)
    AssertionError: 1 not less than 0

    ======================================================================
    FAIL: test_strxfrm_with_diacritic (test.test_locale.TestEnUSCollation)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/sdcard/org.bitbucket.pyona/lib/python3.7/test/test_locale.py", line 365, in test_strxfrm_with_diacritic
        self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
    AssertionError: 'à' not less than 'b'

    @xdegaye xdegaye mannequin added the 3.7 label Dec 17, 2016
    @xdegaye xdegaye mannequin self-assigned this Dec 17, 2016
    @xdegaye xdegaye mannequin added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Dec 17, 2016
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Dec 17, 2016

    Both strcoll() and strxfrm() are broken (character 'à' unicode code point is 'e0'):

    >>> import locale
    >>> locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
    'C.UTF-8'
    >>> locale.strcoll('\u00e0', 'b')
    1
    >>> locale.strxfrm('\u00e0') < locale.strxfrm('b')
    False

    The correct results are -1 and True.

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented Dec 17, 2016

    Here is a patch that skips test_strcoll_with_diacritic and test_strxfrm_with_diacritic.

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Dec 17, 2016

    I'm afraid that the sentence "wcscoll/wcsxfrm have known bugs" is misleading for people who are not quite familiar with Android. The actual cause is that BioniC's setlocale() behaves differently than other platforms. Most implementations returns NULL if en_US.UTF-8 is not available, but BioniC returns C.UTF-8. I guess it's better to add some comments for the real cause on Android.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Dec 19, 2016

    New changeset 781c56168484 by Xavier de Gaye in branch '3.6':
    Issue bpo-28996: Skip two tests that fail on Android with the locale strcoll() and
    https://hg.python.org/cpython/rev/781c56168484

    New changeset 5c5cf7687dc1 by Xavier de Gaye in branch 'default':
    Issue bpo-28996: Merge 3.6.
    https://hg.python.org/cpython/rev/5c5cf7687dc1

    @xdegaye xdegaye mannequin closed this as completed Dec 19, 2016
    @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 tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    0 participants