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 methane
Recipients methane
Date 2014-11-04.08:44:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1415090680.18.0.893315125162.issue22791@psf.upfronthosting.co.za>
In-reply-to
Content
In [1]: import datetime

In [2]: datetime.datetime.utcfromtimestamp(0)
Out[2]: datetime.datetime(1970, 1, 1, 0, 0)

In [3]: datetime.datetime.utcfromtimestamp(0).replace(tzinfo=datetime.timezone.utc)
Out[3]: datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)

datetime.utcfromtimestamp() returns naive datetime.
But some methods assumes naive datetime is localtime. (e.g. datetime.timestamp()).
This is big pitfall for many Pythonistas.

We can't change default behavior for backward compatibility.
How about adding `aware` keyword-only option?

>>> datetime.datetime.utcfromtimestamp(0, aware=True)
datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
History
Date User Action Args
2014-11-04 08:44:40methanesetrecipients: + methane
2014-11-04 08:44:40methanesetmessageid: <1415090680.18.0.893315125162.issue22791@psf.upfronthosting.co.za>
2014-11-04 08:44:40methanelinkissue22791 messages
2014-11-04 08:44:39methanecreate