This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

作者 Alexander.Belopolsky
收信人 Alexander.Belopolsky, amaury.forgeotdarc, blais, loewis, vstinner
日期 2010-02-18.22:28:54
SpamBayes Score 4.046043e-09
Marked as misclassified
Message-id <1266532136.71.0.968702228362.issue1726687@psf.upfronthosting.co.za>
In-reply-to
内容
I wonder: with year bounds being checked in gettmarg() and mktime accepting arbitrary values for the rest of the tm structure members (at least it appears to on my Mac), is it possible trigger "mktime argument out of range"?

If it is possible, then a unit test should be added for such case.  Note that the issue2736 patch contains a typo that assures that overflow is never reported, but the unit test presented here does not catch that bug:

"""
+	buf.tm_wday = -1;
 	tt = mktime(&buf);
-	if (tt == (time_t)(-1)) {
+	if (tt == (time_t)(-1) && buf.tm_wday == 1) {
 		PyErr_SetString(PyExc_OverflowError,
 				"mktime argument out of range");
"""
(Note missing '-' in buf.tm_wday == 1 check. See issue2736.)
历史
日期 用户 动作 参数
2010-02-18 22:28:56Alexander.Belopolsky修改recipients: + Alexander.Belopolsky, loewis, amaury.forgeotdarc, blais, vstinner
2010-02-18 22:28:56Alexander.Belopolsky修改messageid: <1266532136.71.0.968702228362.issue1726687@psf.upfronthosting.co.za>
2010-02-18 22:28:55Alexander.Belopolsky链接issue1726687 messages
2010-02-18 22:28:55Alexander.Belopolsky创建