[Python-modules-commits] [sphinx] 01/02: Fix LocalTimeZone.utcoffset return value when SOURCE_DATE_EPOCH is set

Dmitry Shachnev mitya57 at moszumanska.debian.org
Tue Jun 21 14:13:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

mitya57 pushed a commit to branch master
in repository sphinx.

commit 54328c849a05b2e7a45a636b121642b25f897c33
Author: Dmitry Shachnev <mitya57 at gmail.com>
Date:   Sun Jun 19 16:40:42 2016 +0300

    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'.
    
    Patch-Name: fix_ltz_utcoffset.diff
---
 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 1c47893..a7fea86 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):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sphinx.git



More information about the Python-modules-commits mailing list