Message231028
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". |
|
Date |
User |
Action |
Args |
2014-11-11 15:34:18 | brett.cannon | set | recipients:
+ brett.cannon, lemburg, belopolsky, ethan.furman, dgorley |
2014-11-11 15:34:18 | brett.cannon | set | messageid: <1415720058.71.0.92264598752.issue22840@psf.upfronthosting.co.za> |
2014-11-11 15:34:18 | brett.cannon | link | issue22840 messages |
2014-11-11 15:34:18 | brett.cannon | create | |
|