Brian Guo added the comment: >From the datetime documentation of astimezone(): https://docs.python.org/3.5/library/datetime.html#datetime.datetime.astimezone :
'If called without arguments (or with tz=None) the system local timezone is assumed. The tzinfo attribute of the converted datetime instance will be set to an instance of timezone with the zone name and offset obtained from the OS.' You are correct in saying that there is an error in this implementation, but it is not that the second call should not change the timezone. Rather, the first call should have changed the timezone from UTC to America/New_York, or EST/EDT. When you made your first astimezone() call, (t = u.astimezone()), it was made without a tzinfo parameter, and should result in t's timzeone being EST by the documentation. I have provided a patch that successfully adheres to this documentation. On changing the method, some of the tests failed; I have changed those tests to pass on the correct implementation of the method. ---------- nosy: +BGuo1 Added file: http://bugs.python.org/file42267/bguo.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26616> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com