summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-12-03 11:02:43 (GMT)
committerGitHub <noreply@github.com>2018-12-03 11:02:43 (GMT)
commitab6614969301b238fcc27f43923a0189a57a2a3c (patch)
tree86fd5f15b502a534bf3439aeb191e6f0bea90c80
parent4013c179117754b039957db4730880bf3285919d (diff)
downloadcpython-ab6614969301b238fcc27f43923a0189a57a2a3c.zip
cpython-ab6614969301b238fcc27f43923a0189a57a2a3c.tar.gz
cpython-ab6614969301b238fcc27f43923a0189a57a2a3c.tar.bz2
bpo-35373: Fix PyInit_timezone() if HAVE_DECL_TZNAME is defined (GH-10861)
If HAVE_DECL_TZNAME, PyInit_timezone() now returns -1 on error.
-rw-r--r--Modules/timemodule.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 188f1e6..61041c9 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -1581,16 +1581,17 @@ PyInit_timezone(PyObject *m)
PyModule_AddIntConstant(m, "daylight", daylight);
otz0 = PyUnicode_DecodeLocale(tzname[0], "surrogateescape");
if (otz0 == NULL) {
- return;
+ return -1;
}
otz1 = PyUnicode_DecodeLocale(tzname[1], "surrogateescape");
if (otz1 == NULL) {
Py_DECREF(otz0);
- return;
+ return -1;
}
PyObject *tzname_obj = Py_BuildValue("(NN)", otz0, otz1);
- if (tzname_obj == NULL)
- return;
+ if (tzname_obj == NULL) {
+ return -1;
+ }
PyModule_AddObject(m, "tzname", tzname_obj);
#else // !HAVE_DECL_TZNAME
static const time_t YEAR = (365 * 24 + 6) * 3600;