classification
Title: test_time errors on AIX
Type: behavior Stage: resolved
Components: Interpreter Core, Tests Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Michael.Felt, kadler, ncoghlan, vstinner
Priority: normal Keywords: patch

Created on 2018-08-10 16:15 by Michael.Felt, last changed 2019-06-19 19:09 by Michael.Felt. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8726 merged Michael.Felt, 2018-08-10 16:23
PR 12726 merged vstinner, 2019-04-08 12:39
PR 14242 closed Michael.Felt, 2019-06-19 19:09
Messages (6)
msg323372 - (view) Author: Michael Felt (Michael.Felt) * Date: 2018-08-10 16:15
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.
msg324412 - (view) Author: Michael Felt (Michael.Felt) * Date: 2018-08-31 09:29
Would be very nice to get this to clear on the build bots!
msg332657 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2018-12-28 13:57
New changeset e2926b72488596f59e43c27f3b7cedf0c5b9e88e by Nick Coghlan (Michael Felt) in branch 'master':
bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX (GH-8726)
https://github.com/python/cpython/commit/e2926b72488596f59e43c27f3b7cedf0c5b9e88e
msg337635 - (view) Author: Michael Felt (Michael.Felt) * Date: 2019-03-10 18:43
Could this alos be backported to Version 3.7 and 3.6 - thx!
msg337697 - (view) Author: Michael Felt (Michael.Felt) * Date: 2019-03-11 21:42
On 10/03/2019 19:43, Michael Felt wrote:
> Michael Felt <aixtools@felt.demon.nl> 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 <report@bugs.python.org>
> <https://bugs.python.org/issue34373>
> _______________________________________
>
msg339786 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-04-09 17:12
New changeset 8709490f48fc27b3dd1a16acb33bea2299c6a575 by Victor Stinner in branch 'master':
bpo-34373: Fix time.mktime() on AIX (GH-12726)
https://github.com/python/cpython/commit/8709490f48fc27b3dd1a16acb33bea2299c6a575
History
Date User Action Args
2019-06-19 19:09:09Michael.Feltsetpull_requests: + pull_request14077
2019-04-09 17:12:30vstinnersetnosy: + vstinner
messages: + msg339786
2019-04-08 12:39:53vstinnersetpull_requests: + pull_request12649
2019-03-12 07:35:11Michael.Feltsetversions: - Python 3.6
2019-03-11 21:42:53Michael.Feltsetmessages: + msg337697
2019-03-10 18:43:56Michael.Feltsetmessages: + msg337635
versions: + Python 3.6, Python 3.7
2018-12-28 14:06:07ncoghlansetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-12-28 13:57:48ncoghlansetnosy: + ncoghlan
messages: + msg332657
2018-11-09 19:00:35kadlersetnosy: + kadler
2018-09-11 05:45:48Michael.Feltsetversions: - Python 3.7
2018-09-11 05:45:27Michael.Feltsettype: behavior
2018-08-31 09:29:06Michael.Feltsetmessages: + msg324412
2018-08-10 16:23:57Michael.Feltsetkeywords: + patch
stage: patch review
pull_requests: + pull_request8210
2018-08-10 16:15:51Michael.Feltcreate