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 ezio.melotti
Recipients belopolsky, djc, ezio.melotti, r.david.murray
Date 2013年02月23日.07:38:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1361605118.58.0.563277597269.issue10213@psf.upfronthosting.co.za>
In-reply-to
Content
I tried to reproduce the issue and copied /usr/share/zoneinfo/Factory to /etc/localtime as suggested in msg119762.
Only 2.7 and 3.2 are affected:
>>> import time
>>> time.strftime('%Z', time.gmtime(time.time()))
'Local time zone must be set--see zic manual page'
On 3.3+ this return 'GMT':
>>> import time
>>> time.strftime('%Z', time.gmtime(time.time()))
'GMT'
The error comes from the libc strftime:
$ cat tz.c 
#include <stdio.h>
#include <time.h>
int main() {
 int buflen;
 char outbuf[256];
 struct tm *buf;
 time_t curtime;
 time(&curtime);
 buf = localtime(&curtime);
 buflen = strftime(outbuf, 256, "%Z", buf);
 printf("outbuf: %s\nbuflen: %d\n", outbuf, buflen);
 return 0;
}
$ gcc -Wall -Wextra -O -ansi -pedantic tz.c -o tz
$ ./tz 
outbuf: Local time zone must be set--see zic manual page
buflen: 48
There are different possible solutions:
 1) we close the issue as out of date, since it's fixed in 3.3+;
 2) we fix the test on 2.7/3.2 by checking for the error message and raising a SkipTest;
 3) we fix the code on 2.7/3.2 by backporting the 3.3 implementation that returns 'GMT';
 4) we fix the code on 2.7/3.2 by checking for the error message and raising an exception;
History
Date User Action Args
2013年02月23日 07:38:38ezio.melottisetrecipients: + ezio.melotti, belopolsky, djc, r.david.murray
2013年02月23日 07:38:38ezio.melottisetmessageid: <1361605118.58.0.563277597269.issue10213@psf.upfronthosting.co.za>
2013年02月23日 07:38:38ezio.melottilinkissue10213 messages
2013年02月23日 07:38:37ezio.melotticreate

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