homepage

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 gregory.p.smith
Recipients Sriram Rajagopalan, gregory.p.smith
Date 2016年02月29日.21:26:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1456781193.02.0.504000860673.issue26460@psf.upfronthosting.co.za>
In-reply-to
Content
Python's time.strptime() behavior is consistent with that of glibc 2.19:
======= strptime_c.c =======
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int
main(void)
{
 struct tm tm;
 char buf[255];
 memset(&tm, 0, sizeof(struct tm));
 strptime("Feb 29", "%b %d", &tm);
 strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
 puts(buf);
 exit(EXIT_SUCCESS);
}
=======
$ gcc strptime_c.c 
$ ./a.out
29 Feb 1900 00:00
I'm not saying that the behavior is a good API, but given the unfortunate API at hand, parsing a date without specifying what year it is using strptime is a bad idea.
History
Date User Action Args
2016年02月29日 21:26:33gregory.p.smithsetrecipients: + gregory.p.smith, Sriram Rajagopalan
2016年02月29日 21:26:33gregory.p.smithsetmessageid: <1456781193.02.0.504000860673.issue26460@psf.upfronthosting.co.za>
2016年02月29日 21:26:32gregory.p.smithlinkissue26460 messages
2016年02月29日 21:26:32gregory.p.smithcreate

AltStyle によって変換されたページ (->オリジナル) /