[issue1726687] Bug found in datetime for Epoch time = -1
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Backported in r88425 (3.1) and r88427 (2.7). -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Committed in revision 87919. If bots are happy about the unit test, this should be backported to 3.1 and 2.7. -- resolution: - fixed stage: unit test needed - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Is this important enough to try to get in 2.7 before rc2? Victor? -- components: +Extension Modules -None type: - behavior versions: +Python 3.2 -Python 2.5, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
STINNER Victor victor.stin...@haypocalc.com added the comment: Is this important enough to try to get in 2.7 before rc2? I prefer to not include this patch in 2.7. I don't think that many people have this problem and it can be fixed later. It's too late for 2.7. Should it be fixed in 2.7.1 or only in 3.2 (and maybe in 3.1)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: -- priority: normal - low stage: patch review - unit test needed versions: +Python 3.1 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: -- assignee: - belopolsky nosy: +belopolsky -Alexander.Belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
Alexander Belopolsky alexander.belopol...@gmail.com added the comment: 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.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Is the break intended in the test function? it seems that this will skip the whole test. Isn't continue better? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
STINNER Victor victor.stin...@haypocalc.com added the comment: @Amaury: You wrote: But negative time_t are still not allowed by the Microsoft CRT, the tests fail. So I choosed to skip mktime(-1) test if mktime(-2) fails. I don't have Windows to test my patch nor current behaviour. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
STINNER Victor victor.stin...@haypocalc.com added the comment: New version of my fix: - the test doesn't depend on _my_ local anymore: it uses localtime() to get the time tuple in the host local - ignore the test if mktime(-2) raise an OverflowError: avoid the test on Windows Is it now ok for everyone? -- Added file: http://bugs.python.org/file13378/fix_mktime-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
STINNER Victor victor.stin...@haypocalc.com added the comment: But negative time_t are still not allowed by the Microsoft CRT, the tests fail. (...) is this a bug or a feature request? Linux mktime() supports any timestamp from 1901..2038. Should we limit the timestamp to 1970 just because of Microsoft? Test tm_wday fixes a bug on Linux and doesn't change the behaviour on Windows. So the problem is just the unit test: the test should be different on Windows (make sure that -1 raises an error). ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
STINNER Victor victor.stin...@haypocalc.com added the comment: My test included in mktime_fix_and_tests.patch has a problem: the timezone is constant and it's mine (GMT+1). I don't know how to write a generic test working on any time zone. I can't use datetime.fromtimestamp() because datetime.fromtimestamp() uses time.mktime() :-) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment: on Windows (with Visual Studio), mktime() also sets tm_wday only if successful. But negative time_t are still not allowed by the Microsoft CRT, the tests fail. There are workaround to this - for example python could use techniques similar to http://robertinventor.com/software/t64/ OTOH, the docs of the time module explicitly says that dates before the Epoch are not handled. Do you want to change this? in other words: is this a bug or a feature request? http://docs.python.org/library/time.html -- nosy: +amaury.forgeotdarc ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
STINNER Victor [EMAIL PROTECTED] added the comment: Can anyone review the last patch? -- keywords: +needs review stage: - patch review ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1726687] Bug found in datetime for Epoch time = -1
STINNER Victor [EMAIL PROTECTED] added the comment: The patch is correct. I tried to use errno, but errno is unchanged on error. Here is a new patch with regression tests. -- nosy: +haypo versions: +Python 2.7, Python 3.1 Added file: http://bugs.python.org/file11982/mktime_fix_and_tests.patch ___ Python tracker [EMAIL PROTECTED] http://bugs.python.org/issue1726687 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com