summaryrefslogtreecommitdiffstats
path: root/Python/pytime.c
diff options
context:
space:
mode:
authorMichael Felt <aixtools@users.noreply.github.com>2018-12-28 13:57:37 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2018-12-28 13:57:37 (GMT)
commite2926b72488596f59e43c27f3b7cedf0c5b9e88e (patch)
treedc8a3af47e822ffc6573726decb9c8dd75e6af7a /Python/pytime.c
parentc465682718f15cd3deb6b37db5fb607718ac64ed (diff)
downloadcpython-e2926b72488596f59e43c27f3b7cedf0c5b9e88e.zip
cpython-e2926b72488596f59e43c27f3b7cedf0c5b9e88e.tar.gz
cpython-e2926b72488596f59e43c27f3b7cedf0c5b9e88e.tar.bz2
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.
Diffstat (limited to 'Python/pytime.c')
-rw-r--r--Python/pytime.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Python/pytime.c b/Python/pytime.c
index 0e94131..68c49a8 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) {