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 brett.cannon
Recipients belopolsky, brett.cannon, dgorley, ethan.furman, lemburg
Date 2014-11-11.15:34:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415720058.71.0.92264598752.issue22840@psf.upfronthosting.co.za>
In-reply-to
Content
strptime very much follows the POSIX standard as I implemented strptime by reading that doc.

If you want to see how the behaviour is implemented you can look at https://hg.python.org/cpython/file/ac0334665459/Lib/_strptime.py#l178 . But the key thing here is that the OP has unused formatters. Since strptime uses regexes underneath the hood, the re module does its best to match the entire format. Since POSIX says that e.g. the leading 0 for %m is optional, the regex goes with the single digit version to let the %H format match _something_ (same goes for %d and %M). So without rewriting strptime to not use regexes to support unused formatters and to stop being so POSIX-compliant, I don't see how to change the behaviour. Plus it would be backwards-incompatible as this is how strptime has worked in 2002.

It's Alexander's call, but I vote to close this as "not a bug".
History
Date User Action Args
2014-11-11 15:34:18brett.cannonsetrecipients: + brett.cannon, lemburg, belopolsky, ethan.furman, dgorley
2014-11-11 15:34:18brett.cannonsetmessageid: <1415720058.71.0.92264598752.issue22840@psf.upfronthosting.co.za>
2014-11-11 15:34:18brett.cannonlinkissue22840 messages
2014-11-11 15:34:18brett.cannoncreate