summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-02-15 15:51:17 (GMT)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>2011-02-15 15:51:17 (GMT)
commit6233b36d142572ca35b3563657c539210c554dd6 (patch)
treed78e59e8b8b726e33c1fe4487a95528ef8b4dd55 /Modules
parent42bb7ca9e4559222e22aa44f30f8854e2110b9b8 (diff)
downloadcpython-6233b36d142572ca35b3563657c539210c554dd6.zip
cpython-6233b36d142572ca35b3563657c539210c554dd6.tar.gz
cpython-6233b36d142572ca35b3563657c539210c554dd6.tar.bz2
Merged revisions 87919 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87919 | alexander.belopolsky | 2011-01-10 20:21:25 -0500 (Mon, 10 Jan 2011) | 4 lines Issue #1726687: time.mktime() will now correctly compute value one second before epoch. Original patch by Peter Wang, reported by Martin Blais. ........
Diffstat (limited to 'Modules')
-rw-r--r--Modules/timemodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 1ebee6f..61c1ccc 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -632,8 +632,11 @@ time_mktime(PyObject *self, PyObject *tup)
time_t tt;
if (!gettmarg(tup, &buf))
return NULL;
+ buf.tm_wday = -1; /* sentinel; original value ignored */
tt = mktime(&buf);
- if (tt == (time_t)(-1)) {
+ /* Return value of -1 does not necessarily mean an error, but tm_wday
+ * cannot remain set to -1 if mktime succedded. */
+ if (tt == (time_t)(-1) && buf.tm_wday == -1) {
PyErr_SetString(PyExc_OverflowError,
"mktime argument out of range");
return NULL;