STINNER Victor added the comment:

I reviewed datetime_fromtimestamp_decimal.patch.

> As side effect Decimal timestamps now are supported in few other places, e.g. 
> in os.utime().

It would be more consistent to support decimal.Decimal nowhere or "everywhere". 
IMO the new _PyTime_FromSecondsObject() (very close to 
_PyTime_ObjectToDenominator, but using time_t) should also be patched.

Please add some tests for decimal.Decimal in test_time directly. Usually, I try 
to test rounding and overflow. Testing for overflow is not always possible 
because it may depend on the platform.

--

See also the PEP 410: "PEP 410 - Use decimal.Decimal type for timestamps". The 
PEP was rejected. The compromise was a new timestamp format for os.utime(): a 
number of nanoseconds since the UNIX epoch (1970-01-01). I partially 
implemented a private API for this PEP in the issue #22117: the new _PyTime_t 
is a number of timestamp using an arbitrary resolution (currently, it's a 
number of nanoseconds using a 64-bit signed integer type).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23607>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to