Skip to content

test_time errors on AIX #78554

Closed
Closed

Description

@aixtools
BPO 34373
Nosy @ncoghlan, @vstinner, @aixtools, @kadler
PRs
  • bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX #8726
  • bpo-34373: Fix time.mktime() on AIX #12726
  • [3.7] bpo-34373: Fix time.mktime() on AIX (GH-12726) #14242
  • 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-28.14:06:07.332>
    created_at = <Date 2018-08-10.16:15:51.845>
    labels = ['interpreter-core', '3.8', 'type-bug', 'tests', '3.7']
    title = 'test_time errors on AIX'
    updated_at = <Date 2019-06-19.19:09:09.241>
    user = 'https://github.com/aixtools'

    bugs.python.org fields:

    activity = <Date 2019-06-19.19:09:09.241>
    actor = 'Michael.Felt'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-12-28.14:06:07.332>
    closer = 'ncoghlan'
    components = ['Interpreter Core', 'Tests']
    creation = <Date 2018-08-10.16:15:51.845>
    creator = 'Michael.Felt'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34373
    keywords = ['patch']
    message_count = 6.0
    messages = ['323372', '324412', '332657', '337635', '337697', '339786']
    nosy_count = 4.0
    nosy_names = ['ncoghlan', 'vstinner', 'Michael.Felt', 'kadler']
    pr_nums = ['8726', '12726', '14242']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34373'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. aixtools commented on Aug 10, 2018

      @aixtools
      ContributorAuthor

      32-bit:

      ======================================================================
      ERROR: test_mktime (test.test_time.TimeTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/data/prj/python/src/python3-3.7.0/Lib/test/test_time.py", line 446, in test_mktime
          self.assertEqual(time.mktime(tt), t)
      OverflowError: mktime argument out of range

      ======================================================================
      FAIL: test_pthread_getcpuclockid (test.test_time.TimeTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/data/prj/python/src/python3-3.7.0/Lib/test/test_time.py", line 129, in test_pthread_getcpuclockid
          self.assertNotEqual(clk_id, time.CLOCK_THREAD_CPUTIME_ID)
      AssertionError: 12 == 12

      64-bit:
      ======================================================================
      ERROR: test_mktime (test.test_time.TimeTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/opt/lib/python3.7/test/test_time.py", line 446, in test_mktime
          self.assertEqual(time.mktime(tt), t)
      OverflowError: mktime argument out of range

      ======================================================================
      ERROR: test_pthread_getcpuclockid (test.test_time.TimeTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/opt/lib/python3.7/test/test_time.py", line 130, in test_pthread_getcpuclockid
          t1 = time.clock_gettime(clk_id)
      OverflowError: signed integer is greater than maximum

      The test_mktime failed because
      time.mktime(time.localtime(-2)) -- actually any negative value in localtime - fails

      The patch in the file Modules/timemodule.c fixes this.

      The test_pthread_getcpuclockid is a bit more complex as the result is different
      depending on 32 or 64-bit mode.

      In 32-bit mode AIX always responds with the constant CLOCK_THREAD_CPUTIME_ID.
      The patch in Lib/test/test_time.py makes the test aware of this.

      In AIX clockid_t is actually long long. However, changing the type to parse to "L"
      broke many other things. It seems to work as a long ("l") when the ABI is 64-bit.

      See additional change in Modules/timemodule.c
      static PyObject *
      time_clock_gettime

      Finally,
      added some (additional) range checking for
      _PyTime_localtime for AIX. Not having this complicated testing for above.

    2. aixtools commented on Aug 31, 2018

      @aixtools
      ContributorAuthor

      Would be very nice to get this to clear on the build bots!

    3. added
      type-bugAn unexpected behavior, bug, or error
      and removed on Sep 11, 2018
    4. ncoghlan commented on Dec 28, 2018

      @ncoghlan
      Contributor

      New changeset e2926b7 by Nick Coghlan (Michael Felt) in branch 'master':
      bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX (GH-8726)
      e2926b7

    5. aixtools commented on Mar 10, 2019

      @aixtools
      ContributorAuthor

      Could this alos be backported to Version 3.7 and 3.6 - thx!

    6. aixtools commented on Mar 11, 2019

      @aixtools
      ContributorAuthor

      On 10/03/2019 19:43, Michael Felt wrote:

      Michael Felt <[email protected]> added the comment:

      Could this alos be backported to Version 3.7 and 3.6 - thx!
      As 3.6 is in security mode - I guess only 3.7 then.
      ----------
      versions: +Python 3.6, Python 3.7


      Python tracker <[email protected]>
      <https://bugs.python.org/issue34373\>


    7. vstinner commented on Apr 9, 2019

      @vstinner
      Member

      New changeset 8709490 by Victor Stinner in branch 'master':
      bpo-34373: Fix time.mktime() on AIX (GH-12726)
      8709490

    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)end of life3.8 (EOL)end of lifeinterpreter-core(Objects, Python, Grammar, and Parser dirs)testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions