[New-bugs-announce] [issue26616] A bug in datetime.astimezone() method

Alexander Belopolsky report at bugs.python.org
Wed Mar 23 01:25:06 EDT 2016


New submission from Alexander Belopolsky:

With TZ=America/New_York,

>>> from datetime import *
>>> u = datetime(2015, 11, 1, 5, tzinfo=timezone.utc)
>>> t = u.astimezone()
>>> print(t)
2015-11-01 01:00:00-04:00
>>> print(t.astimezone())
2015-11-01 00:00:00-05:00

which is wrong - the second call to astimezone() should not change the timezone.  Note that pure python code does not have this bug.  (Try setiing sys.module['_datetime'] = None before running the code above.)

----------
components: Extension Modules
messages: 262239
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: A bug in datetime.astimezone() method
type: behavior
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26616>
_______________________________________


More information about the New-bugs-announce mailing list