bpo-34373: fix test_mktime and test_pthread_getcpuclickid tests on AIX (GH-8726)

* Fix test_mktime on AIX by adding code to get mktime to behave the
  same way as it does on other *nix systems
* Fix test_pthread_getcpuclickid in AIX by adjusting the test case
  expectations when running on AIX in 32-bit mode

Patch by Michael Felt.
This commit is contained in:
Michael Felt 2018-12-28 14:57:37 +01:00 committed by Nick Coghlan
parent c465682718
commit e2926b7248
4 changed files with 57 additions and 20 deletions

View file

@ -1062,6 +1062,20 @@ _PyTime_localtime(time_t t, struct tm *tm)
}
return 0;
#else /* !MS_WINDOWS */
#ifdef _AIX
/* AIX does not return NULL on an error
so test ranges - asif!
(1902-01-01, -2145916800.0)
(2038-01-01, 2145916800.0) */
if (abs(t) > (time_t) 2145916800) {
#ifdef EINVAL
errno = EINVAL;
#endif
PyErr_SetString(PyExc_OverflowError,
"ctime argument out of range");
return -1;
}
#endif
if (localtime_r(&t, tm) == NULL) {
#ifdef EINVAL
if (errno == 0) {