From ae0d97bb260a689c4165febb12f9d716d632112c Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 13 Aug 2023 20:02:28 +0100 Subject: [PATCH] Use ``parsedate_tz`` in the linkcheck builder --- sphinx/builders/linkcheck.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 1de3fe0eb..4825d51f6 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -490,9 +490,10 @@ class HyperlinkAvailabilityCheckWorker(Thread): try: # An HTTP-date: time of next attempt. parsed = parsedate_tz(retry_after) + assert parsed is not None # the 10th element is the GMT offset in seconds - next_check = time.mktime(parsed[:9]) - parsed[9] - except (TypeError, ValueError): + next_check = time.mktime(parsed[:9]) - (parsed[9] or 0) + except (AssertionError, TypeError, ValueError): # TypeError: Invalid date format. # ValueError: Invalid date, e.g. Oct 52th. pass