From da39a9151d1068cef7a74f43ba6088949df3dbc9 Mon Sep 17 00:00:00 2001 From: M Felt aka aixtools Date: Thu, 6 Feb 2020 21:10:01 +0000 Subject: [PATCH 1/3] Fix :func:`time.localtime` on 64-bit AIX to support years before 1902 and after 2038 --- .../Core and Builtins/2020-01-30-14-36-31.bpo-39502.IJu0rl.rst | 2 ++ Python/pytime.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-01-30-14-36-31.bpo-39502.IJu0rl.rst 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 index 000000000000000..c9fdef9ce695885 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-30-14-36-31.bpo-39502.IJu0rl.rst @@ -0,0 +1,2 @@ +Fix :func:`time.localtime` on 64-bit AIX to support years before 1902 and after 2038 +Patch by M Felt diff --git a/Python/pytime.c b/Python/pytime.c index 54ddfc952b81792..0be7b76fe431e04 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -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 == 4) /* 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 */) { From a55ad44fdef455be0980b496618fbf3f31053457 Mon Sep 17 00:00:00 2001 From: Michael Felt Date: Fri, 7 Feb 2020 17:07:14 +0100 Subject: [PATCH 2/3] Update Python/pytime.c Co-Authored-By: Victor Stinner --- Python/pytime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/pytime.c b/Python/pytime.c index 0be7b76fe431e04..9b2b74af5c04385 100644 --- a/Python/pytime.c +++ b/Python/pytime.c @@ -1059,7 +1059,7 @@ _PyTime_localtime(time_t t, struct tm *tm) return 0; #else /* !MS_WINDOWS */ -#if defined(_AIX) && (SIZEOF_TIME_T == 4) +#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 */) { From c17f267f4b041fbac5150d60038b057969254e28 Mon Sep 17 00:00:00 2001 From: M Felt aka aixtools Date: Fri, 7 Feb 2020 16:09:53 +0000 Subject: [PATCH 3/3] add missing periods --- .../2020-01-30-14-36-31.bpo-39502.IJu0rl.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index c9fdef9ce695885..93b3639c80c5bae 100644 --- 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 @@ -1,2 +1,2 @@ -Fix :func:`time.localtime` on 64-bit AIX to support years before 1902 and after 2038 -Patch by M Felt +Fix :func:`time.localtime` on 64-bit AIX to support years before 1902 and after 2038. +Patch by M Felt.