Author joernheissler
Recipients joernheissler
Date 2019-07-21.11:41:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Content 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))

# Python
>>> timezone(timedelta(seconds=86399))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cpython/Lib/", 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)
Date User Action Args
2019-07-21 11:41:24joernheisslersetrecipients: + joernheissler
2019-07-21 11:41:24joernheisslersetmessageid: <>
2019-07-21 11:41:24joernheisslerlinkissue37642 messages
2019-07-21 11:41:23joernheisslercreate