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 barronh
Recipients barronh
Date 2009-03-11.15:50:44
SpamBayes Score 8.757283e-08
Marked as misclassified No
Message-id <1236786647.39.0.745171492116.issue5476@psf.upfronthosting.co.za>
In-reply-to
Content
Initializing a timedelta object with numpy.int32 arguments give mixed
results; it fails for days keyword, gives bad results for minutes, and
give correct results for seconds/microseconds.  Failure confirmed on
Linux i686 (Py 2.5.2; numpy 1.2.1) and OS X 10.5.6 (Py 2.5.1;
1.2.1).Test case below:

from datetime import timedelta
from numpy import int32
from numpy import int32
from datetime import timedelta

assert timedelta(seconds = 36) == timedelta(seconds = int32(36))
print 'pass 36 sec'
assert timedelta(microseconds = 36) == timedelta(microseconds = int32(36))
print 'pass 36 usec'
assert timedelta(minutes = 35) == timedelta(minutes = int32(35))
print 'pass 35 min'
assert timedelta(minutes = 36) == timedelta(minutes = int32(36))
print 'pass 36 min' # returns bad value
assert timedelta(days = 36) == timedelta(days = int32(36))
print 'pass 36 days' # fails SystemError: Objects/longobject.c:223
History
Date User Action Args
2009-03-11 15:50:47barronhsetrecipients: + barronh
2009-03-11 15:50:47barronhsetmessageid: <1236786647.39.0.745171492116.issue5476@psf.upfronthosting.co.za>
2009-03-11 15:50:45barronhlinkissue5476 messages
2009-03-11 15:50:45barronhcreate