New submission from Jörn Heissler <[email protected]>:
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)
----------
components: Library (Lib)
messages: 348237
nosy: joernheissler
priority: normal
severity: normal
status: open
title: timezone allows no offset from range (23:59, 24:00)
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37642>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com