[issue13556] When tzinfo.utcoffset is out-of-bounds, the exception message is misleading
Alexander Belopolsky
report at bugs.python.org
Wed Jan 4 04:51:31 CET 2012
Alexander Belopolsky <alexander.belopolsky at gmail.com> added the comment:
Is 3.3 message better?
>>> datetime.now(tz=X())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).
In 2.7, the message is indeed misleading:
>>> datetime.now(tz=X())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: tzinfo.utcoffset() returned 1440; must be in -1439 .. 1439
I am not sure fixing this in 2.x is worth the trouble, but I would consider improving the message in 3.x by adding information about the actual offset. I vaguely remember that there was a reason for leaving that info out in 3.x.
----------
assignee: -> belopolsky
stage: -> needs patch
versions: +Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13556>
_______________________________________
More information about the Python-bugs-list
mailing list