mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix LocalTimeZone.utcoffset return value when SOURCE_DATE_EPOCH is set
Subclasses of tzinfo should follow the parent class and return offset either as None (when unknown) or as timedelta. Otherwise datetime.fromtimestamp() will raise a TypeError: tzinfo.utcoffset() must return None or timedelta, not 'int'.
This commit is contained in:
@@ -135,7 +135,7 @@ tzdelta = datetime.fromtimestamp(timestamp) - \
|
||||
source_date_epoch = getenv('SOURCE_DATE_EPOCH')
|
||||
if source_date_epoch is not None:
|
||||
timestamp = float(source_date_epoch)
|
||||
tzdelta = 0
|
||||
tzdelta = timedelta(0)
|
||||
|
||||
|
||||
class LocalTimeZone(tzinfo):
|
||||
|
||||
Reference in New Issue
Block a user