diff options
author | Michael Felt <aixtools@users.noreply.github.com> | 2020-02-07 17:56:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-07 17:56:16 (GMT) |
commit | de6f38db4859f7b8fe4da4556f06c52675fff24a (patch) | |
tree | 027c9faf91b3cf18cdc87adab7a4a7ae5f9907e2 | |
parent | b10dc3e7a11fcdb97e285882eba6da92594f90f9 (diff) | |
download | cpython-de6f38db4859f7b8fe4da4556f06c52675fff24a.zip cpython-de6f38db4859f7b8fe4da4556f06c52675fff24a.tar.gz cpython-de6f38db4859f7b8fe4da4556f06c52675fff24a.tar.bz2 |
bpo-39502: Fix 64-bit Python PyTime_localtime() on AIX (GH-18285)
Fix time.localtime() on 64-bit AIX to support years before 1902 and after 2038.
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2020-01-30-14-36-31.bpo-39502.IJu0rl.rst | 2 | ||||
-rw-r--r-- | Python/pytime.c | 2 |
2 files changed, 3 insertions, 1 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 new file mode 100644 index 0000000..93b3639 --- /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 54ddfc9..9b2b74a 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 < 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 */) { |