mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #19748: On AIX, time.mktime() now raises an OverflowError for year
outsize range [1902; 2037].
This commit is contained in:
parent
24a882bb7b
commit
1ac42614e3
3 changed files with 22 additions and 1 deletions
|
@ -823,7 +823,18 @@ time_mktime(PyObject *self, PyObject *tup)
|
|||
time_t tt;
|
||||
if (!gettmarg(tup, &buf))
|
||||
return NULL;
|
||||
#ifdef _AIX
|
||||
/* year < 1902 or year > 2037 */
|
||||
if (buf.tm_year < 2 || buf.tm_year > 137) {
|
||||
/* Issue #19748: On AIX, mktime() doesn't report overflow error for
|
||||
* timestamp < -2^31 or timestamp > 2**31-1. */
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"mktime argument out of range");
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
buf.tm_wday = -1; /* sentinel; original value ignored */
|
||||
#endif
|
||||
tt = mktime(&buf);
|
||||
/* Return value of -1 does not necessarily mean an error, but tm_wday
|
||||
* cannot remain set to -1 if mktime succeeded. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue