[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No, the bug is not fixed, and this is not easy issue. You should use non-integer Decimals to reproduce it. In 3.8 this emits a deprecation warning: >>> import datetime >>> from decimal import Decimal as D >>> datetime.datetime.utcfromtimestamp(D(1425808327.

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Rémi Lapeyre
Change by Rémi Lapeyre : -- nosy: +remi.lapeyre ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Paul Ganssle
Paul Ganssle added the comment: Oh actually that's my mistake. I can't reproduce the failure in the constructor in the Python version of the module, and also it seems to be fixed in the pure Python version as of at least 3.6: Python 3.6.7 (default, Oct 25 2018, 16:11:17) [GCC 8.2.1 20180831

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-27 Thread Paul Ganssle
Paul Ganssle added the comment: I'm not sure if either of these patches got merged, but at some point this was fixed: Python 3.7.2 (default, Feb 9 2019, 13:18:43) [GCC 8.2.1 20181127] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from da

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2019-02-08 Thread Steven Davidson
Change by Steven Davidson : -- nosy: +Steven Davidson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2018-07-05 Thread Paul Ganssle
Change by Paul Ganssle : -- nosy: +p-ganssle ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2018-05-12 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- assignee: -> serhiy.storchaka priority: normal -> low versions: +Python 3.8 -Python 3.4, Python 3.5 ___ Python tracker ___ _

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2018-05-08 Thread Shlomo Anglister
Change by Shlomo Anglister : -- nosy: +anglister ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-30 Thread Stefan Krah
Stefan Krah added the comment: I think we should try to avoid depending on global state in the stdlib, at least in new code. Also, if something is not really a decimal computation, Decimal itself tries to ignore the context (like Decimal.__repr__). At least I would expect this datetime function

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The problem is that the Decimal *was* supported in 2.7. So this issue can be considered not as adding new feature, but as fixing a regression. But changes are too large for just bugfix. > It would be more consistent to support decimal.Decimal nowhere or > "

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-30 Thread Stefan Krah
Stefan Krah added the comment: I just looked at this very briefly: Is the patch context insensitive? IOW, do things still work if you change the thread-local context: from decimal import * c = getcontext() c.prec = 1 c.Emax = 1 c.Emin = -1 -- nosy: +skrah _

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-30 Thread STINNER Victor
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_FromSecondsOb

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch that adds Decimal support for datetime.fromtimestamp() and datetime.utcfromtimestamp(). As side effect Decimal timestamps now are supported in few other places, e.g. in os.utime(). -- nosy: +haypo stage: needs patch -> patch review Ad

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The fix for Python implementation LGTM, but a fix for C implementation is needed too. -- stage: patch review -> needs patch ___ Python tracker __

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-10 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-08 Thread SilentGhost
SilentGhost added the comment: Here is the python-only fix that eliminates TypeError and produces correct number of milliseconds. The problem with C implementation lies in _PyTime_ObjectToDenominator function where there is an explicit check for a float. This check could be relaxed to include

[issue23607] Inconsistency in datetime.utcfromtimestamp(Decimal)

2015-03-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: First, datetime.utcfromtimestamp() drops fractional part of Decimal argument: >>> import datetime >>> from decimal import Decimal as D >>> datetime.datetime.utcfromtimestamp(1425808327.307651) datetime.datetime(2015, 3, 8, 9, 52, 7, 307651) >>> datetime.date