Author joernheissler
Recipients joernheissler
Date 2019-07-21.11:41:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1563709284.19.0.651842013894.issue37642@roundup.psfhosted.org>
In-reply-to
Content
https://bugs.python.org/issue5288 changed datetime.timezone to accept sub-minute offsets.

The C implementation allows offsets from range (23:59, 24:00) while the python implementation does not:

# C
>>> timezone(timedelta(seconds=86399))
datetime.timezone(datetime.timedelta(seconds=86399))

# Python
>>> timezone(timedelta(seconds=86399))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cpython/Lib/datetime.py", line 2194, in __new__
    raise ValueError("offset must be a timedelta "
ValueError: offset must be a timedelta strictly between -timedelta(hours=24) and timedelta(hours=24).

This is because _maxoffset is defined as timedelta(hours=23, minutes=59)

Second issue: The (undocumented) "min" and "max" attributes (both C and python) show 23:59
even though the C implementation can get closer to 24:00.
Should this be changed to timezone(timedelta(seconds=86399, microseconds=999999))?


(Same applies to the minimums)
History
Date User Action Args
2019-07-21 11:41:24joernheisslersetrecipients: + joernheissler
2019-07-21 11:41:24joernheisslersetmessageid: <1563709284.19.0.651842013894.issue37642@roundup.psfhosted.org>
2019-07-21 11:41:24joernheisslerlinkissue37642 messages
2019-07-21 11:41:23joernheisslercreate