From e2926b72488596f59e43c27f3b7cedf0c5b9e88e Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Fri, 28 Dec 2018 14:57:37 +0100 Subject: 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. --- Python/pytime.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Python/pytime.c') diff --git a/Python/pytime.c b/Python/pytime.c index 0e94131741..68c49a86da 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -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) { -- cgit v1.2.1