From 0b2a4e907352a3438b990939c14524a607472a82 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sun, 19 Jun 2016 16:40:42 +0300 Subject: [PATCH] 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'. --- sphinx/builders/gettext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index 1c4789392..a7fea86fa 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -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):