[Python-checkins] bpo-34672: Don't pass NULL to gmtime_r. (GH-9312)

Benjamin Peterson webhook-mailer at python.org
Fri Sep 14 13:39:16 EDT 2018


https://github.com/python/cpython/commit/b93062b7fbc965cd0d522f597ed51eb4e493dfc2
commit: b93062b7fbc965cd0d522f597ed51eb4e493dfc2
branch: master
author: Benjamin Peterson <benjamin at python.org>
committer: GitHub <noreply at github.com>
date: 2018-09-14T10:39:13-07:00
summary:

bpo-34672: Don't pass NULL to gmtime_r. (GH-9312)

files:
M Modules/timemodule.c

diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 8118b31c9173..1a4cff23d65e 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1764,7 +1764,8 @@ PyInit_time(void)
 
 #if defined(__linux__) && !defined(__GLIBC__)
     struct tm tm;
-    if (gmtime_r(0, &tm) != NULL)
+    const time_t zero = 0;
+    if (gmtime_r(&zero, &tm) != NULL)
         utc_string = tm.tm_zone;
 #endif
 



More information about the Python-checkins mailing list