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 josh.r
Recipients bdkearns, belopolsky, josh.r, lemburg, tim.peters
Date 2014-03-06.23:26:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
That's actually an argument to fix the C datetime implementation. Right now, you get:

    >>> from decimal import Decimal as d
    >>> from datetime import datetime
    >>> datetime(d("2000.5"), 1, 2)
    datetime.datetime(2000, 1, 2, 0, 0)

This is wildly inconsistent; if you passed 2000.0, it would raise an exception because float (even floats directly equivalent to an int value) are forbidden. But the logically equivalent Decimal type will work just fine, silently truncating. Basically any user defined type with integer coercion (but not integer equivalence) would have the same problem; str doesn't, because str is special cased (it doesn't actually have __int__), but any user-defined str-like class that defined int coercion would work as a datetime arg in a way str does not.

You've just given me an excuse to open my first bug. Thanks! :-)
Date User Action Args
2014-03-06 23:26:26josh.rsetrecipients: + josh.r, lemburg, tim.peters, belopolsky, bdkearns
2014-03-06 23:26:26josh.rsetmessageid: <>
2014-03-06 23:26:26josh.rlinkissue20858 messages
2014-03-06 23:26:25josh.rcreate