[rfc] time.gmtime() does not accept negative numbers on win32
Alexander Belchenko
bialix at ukr.net
Wed Apr 18 15:51:24 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Aaron, annotate says that you is the author of test_timestamp.py.
Unfortunately one of the test fails on win32 because gmtime()
does not accept negative seconds (pre-1970 year).
This error raised both on 2.4 and 2.5, so I assume it's
a limitation of win32 C runtime.
Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.gmtime(0)
(1970, 1, 1, 0, 0, 0, 3, 1, 0)
>>> time.gmtime(-1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ValueError: (22, 'Invalid argument')
How the best to change this test:
self.assertEqual('1969-12-31 19:00:00 -0500',
timestamp.format_patch_date(0, -5 * 3600))
Any non-zero value is OK for you? Per example such change:
self.assertEqual('1970-01-01 05:00:00 -0500',
timestamp.format_patch_date(5 * 3600, -5 * 3600))
[µ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGJjBszYr338mxwCURAnr9AKCTDNfY+WUkGtNKDlEl4rP/pxsHaQCeLio7
3+XgSIdUHemK7F3JhUiLF5o=
=g62L
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list