From 014b51e00bec5c365392c1f8442c9292e6cd1e45 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Fri, 22 May 2020 00:54:43 +0900 Subject: [PATCH 1/3] bpo-40714: Remove compile warning from _zoneinfo.c --- Modules/_zoneinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index 9f5e64d8486ccc..f06088afac200a 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -1457,7 +1457,7 @@ parse_tz_str(PyObject *tz_str_obj, _tzrule *out) PyObject *dst_abbr = NULL; TransitionRuleType *start = NULL; TransitionRuleType *end = NULL; - long std_offset, dst_offset; + long std_offset, dst_offset = 0; char *tz_str = PyBytes_AsString(tz_str_obj); if (tz_str == NULL) { @@ -1907,7 +1907,7 @@ build_tzrule(PyObject *std_abbr, PyObject *dst_abbr, long std_offset, long dst_offset, TransitionRuleType *start, TransitionRuleType *end, _tzrule *out) { - _tzrule rv = {0}; + _tzrule rv = {{0}}; rv.start = start; rv.end = end; From e8309e6ea12b44eda7849c45a124a9b322e7d22b Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Fri, 22 May 2020 01:13:00 +0900 Subject: [PATCH 2/3] bpo-40714: Apply Paul's review --- Modules/_zoneinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index f06088afac200a..6e1a399346b4f4 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -1457,7 +1457,8 @@ parse_tz_str(PyObject *tz_str_obj, _tzrule *out) PyObject *dst_abbr = NULL; TransitionRuleType *start = NULL; TransitionRuleType *end = NULL; - long std_offset, dst_offset = 0; + long std_offset = 1 << 20; + long dst_offset = 1 << 20; char *tz_str = PyBytes_AsString(tz_str_obj); if (tz_str == NULL) { From 40b2be9df9fd289c6113287ac8853dacb9f722b3 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Fri, 22 May 2020 01:25:59 +0900 Subject: [PATCH 3/3] Update Modules/_zoneinfo.c Co-authored-by: Paul Ganssle --- Modules/_zoneinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index 6e1a399346b4f4..d7e71576576437 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -1457,6 +1457,7 @@ parse_tz_str(PyObject *tz_str_obj, _tzrule *out) PyObject *dst_abbr = NULL; TransitionRuleType *start = NULL; TransitionRuleType *end = NULL; + // Initialize offsets to invalid value (> 24 hours) long std_offset = 1 << 20; long dst_offset = 1 << 20;