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.

Author vstinner
Recipients belopolsky, vstinner
Date 2015-03-03.14:42:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1425393743.39.0.519990063132.issue23574@psf.upfronthosting.co.za>
In-reply-to
Content
A leap second will be added in June 2015:
http://www.usatoday.com/story/tech/2015/01/08/computer-chaos-feares/21433363/

The datetime module explicitly doesn't support leap seconds:
https://docs.python.org/dev/library/datetime.html#datetime.date.fromtimestamp
"Note that on non-POSIX systems that include leap seconds in their notion of a timestamp, leap seconds are ignored by fromtimestamp()."

The following bug in oslo.utils was reported because datetime is indirectly used to unserialize a date, but it fails with ValueError("second must be in 0..59") if the second is 60:
https://bugs.launchpad.net/oslo.utils/+bug/1427212

Would it be possible to silently drop ignore leap seconds in datetime.datetime constructor, as already done in datetime.datetime.fromtimestamp?

Attached patch modified datetime constructor to drop leap seconds: replace second=60 with second=59. I also changed the error message for second (valid range is now 0..60).
History
Date User Action Args
2015-03-03 14:42:23vstinnersetrecipients: + vstinner, belopolsky
2015-03-03 14:42:23vstinnersetmessageid: <1425393743.39.0.519990063132.issue23574@psf.upfronthosting.co.za>
2015-03-03 14:42:23vstinnerlinkissue23574 messages
2015-03-03 14:42:23vstinnercreate