From 2dae11aa6800af78574d27d0bcc1f121b483c00a Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 18 Mar 2017 18:17:59 +0900 Subject: [PATCH] Fix #3552: linkcheck raises UnboundLocalError --- CHANGES | 1 + sphinx/builders/linkcheck.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 4b1a31979..328298ee5 100644 --- a/CHANGES +++ b/CHANGES @@ -67,6 +67,7 @@ Bugs fixed * #3450:   is appeared in EPUB docs * #3418: Search button is misaligned in nature and pyramid theme * #3421: Could not translate a caption of tables +* #3552: linkcheck raises UnboundLocalError Release 1.5.2 (released Jan 22, 2017) ===================================== diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 563f658b6..74ce76b64 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -167,7 +167,9 @@ class CheckExternalLinksBuilder(Builder): # history contains any redirects, get last if response.history: code = response.history[-1].status_code - return 'redirected', new_url, code + return 'redirected', new_url, code + else: + return 'redirected', new_url, 0 def check(): # check for various conditions without bothering the network