]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39502: Fix 64-bit Python PyTime_localtime() on AIX (GH-18285)
authorMichael Felt <aixtools@users.noreply.github.com>
Fri, 7 Feb 2020 17:56:16 +0000 (18:56 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Feb 2020 17:56:16 +0000 (18:56 +0100)
Fix time.localtime() on 64-bit AIX to support years before 1902 and after 2038.

Misc/NEWS.d/next/Core and Builtins/2020-01-30-14-36-31.bpo-39502.IJu0rl.rst [new file with mode: 0644]
Python/pytime.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-30-14-36-31.bpo-39502.IJu0rl.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-30-14-36-31.bpo-39502.IJu0rl.rst
new file mode 100644 (file)
index 0000000..93b3639
--- /dev/null
@@ -0,0 +1,2 @@
+Fix :func:`time.localtime` on 64-bit AIX  to support years before 1902 and after 2038.
+Patch by M Felt.
index 54ddfc952b81792dec9c36ac5a98f1dc1b27475e..9b2b74af5c04385d082270fbf1e245091be54693 100644 (file)
@@ -1059,7 +1059,7 @@ _PyTime_localtime(time_t t, struct tm *tm)
     return 0;
 #else /* !MS_WINDOWS */
 
-#ifdef _AIX
+#if defined(_AIX) && (SIZEOF_TIME_T < 8)
     /* bpo-34373: AIX does not return NULL if t is too small or too large */
     if (t < -2145916800 /* 1902-01-01 */
        || t > 2145916800 /* 2038-01-01 */) {