Skip to content

android: locale is modified by test_strftime #76320

Closed

Description

@xdegaye
mannequin
BPO 32139
Nosy @vstinner, @xdegaye
PRs
  • bpo-32139: test_strftime does not anymore modify the locale #4569
  • [3.6] bpo-32139: test_strftime does not anymore modify the locale (GH-4569) #4635
  • [2.7] bpo-32139: test_strftime does not anymore modify the locale (GH-4569) #4636
  • 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 2017-11-29.15:31:36.249>
    created_at = <Date 2017-11-26.10:44:43.349>
    labels = ['3.7', 'type-bug', 'tests']
    title = 'android: locale is modified by test_strftime'
    updated_at = <Date 2017-11-29.15:31:36.248>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2017-11-29.15:31:36.248>
    actor = 'xdegaye'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-29.15:31:36.249>
    closer = 'xdegaye'
    components = ['Tests']
    creation = <Date 2017-11-26.10:44:43.349>
    creator = 'xdegaye'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32139
    keywords = ['patch']
    message_count = 6.0
    messages = ['307000', '307217', '307229', '307232', '307234', '307235']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'xdegaye']
    pr_nums = ['4569', '4635', '4636']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue32139'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7']

    Activity

    1. xdegaye commented on Nov 26, 2017

      xdegayemannequin
      MannequinAuthor

      Test results:
      ------------
      1 test altered the execution environment:
      test_strftime

      Warning -- locale was modified by test_strftime
        Before: [(6, 'C.UTF-8'), (3, 'C.UTF-8'), (0, 'C.UTF-8'), (5, 'C.UTF-8'), (4, 'C.UTF-8'), (1, 'C.UTF-8'), (2, 'C.UTF-8')]
        After:  [(6, 'C'), (3, 'C'), (0, 'C'), (5, 'C'), (4, 'C'), (1, 'C'), (2, 'C')] 
      test_strftime failed (env changed)
      

      It seems that the tests indeed modify the environment. To understand the above results one must be aware that the implementation of setlocale() is broken on Android:

      generic_x86_64:/data/local/tmp/python $ python
      Python 3.7.0a2+ (heads/bpo-30386:ebb493ac4e, Nov 25 2017, 18:58:20) 
      [Clang 3.8.275480 ] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from locale import setlocale, LC_TIME, LC_ALL
      >>> setlocale(LC_TIME)
      'C.UTF-8'
      >>> setlocale(LC_ALL)
      'C.UTF-8'
      >>> setlocale(LC_TIME, 'C')
      'C'
      >>> setlocale(LC_TIME)
      'C'
      >>> setlocale(LC_ALL)
      'C'
      >>> setlocale(LC_TIME, 'C.UTF-8')
      'C.UTF-8'
      >>> setlocale(LC_ALL)
      'C.UTF-8'
    2. added
      3.7 (EOL)
      tests
      type-bug
      on Nov 26, 2017
    3. xdegaye commented on Nov 29, 2017

      xdegayemannequin
      MannequinAuthor

      New changeset cc55e78 by xdegaye in branch 'master':
      bpo-32139: test_strftime does not anymore modify the locale (GH-4569)
      cc55e78

    4. vstinner commented on Nov 29, 2017

      @vstinner
      Member

      Python 3.6 and 2.7 are also affected and should be fixed. I requested automated backports.

    5. xdegaye commented on Nov 29, 2017

      xdegayemannequin
      MannequinAuthor

      New changeset b0df786 by xdegaye (Miss Islington (bot)) in branch '3.6':
      bpo-32139: test_strftime does not anymore modify the locale (GH-4569) (bpo-4635)
      b0df786

    6. xdegaye commented on Nov 29, 2017

      xdegayemannequin
      MannequinAuthor

      New changeset bc19cf5 by xdegaye (Miss Islington (bot)) in branch '2.7':
      bpo-32139: test_strftime does not anymore modify the locale (GH-4569) (bpo-4636)
      bc19cf5

    7. xdegaye commented on Nov 29, 2017

      xdegayemannequin
      MannequinAuthor

      Closing now.
      Thanks Victor :-)

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)teststype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions