[issue5476] datetime: timedelta(minutes = i) silently fails with numpy.int32 input

David W. Lambert report at bugs.python.org
Wed Mar 11 17:06:15 CET 2009


David W. Lambert <lambertdw at corning.com> added the comment:

With older versions of each timedelta rejects the data type.  Maybe
that's a good resolution?

$ /usr/local/bin/python2.4 
Python 2.4.2 (#2, Jul  7 2006, 10:20:47) 
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.version.version
'0.9.8'
>>> from numpy import int32
>>> from datetime import timedelta
>>> assert timedelta(seconds = 36) == timedelta(seconds = int32(36))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: unsupported type for timedelta seconds component: int32scalar
>>>

----------
nosy: +LambertDW

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5476>
_______________________________________


More information about the Python-bugs-list mailing list