mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
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. ........
This commit is contained in:
parent
725cb96d8a
commit
4fb96f41f4
2 changed files with 13 additions and 1 deletions
|
|
@ -703,8 +703,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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue