summary refs log tree commit diff
path: root/pkgs/development/python-modules/sphinx-1.3.1-pr-1946.patch
blob: 2933040141aa169d9bb3f88452c637df30221512 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 7ce3b991229c74262f81ab7692a1dc6bde2416ee Mon Sep 17 00:00:00 2001
From: Barry Warsaw <barry@python.org>
Date: Thu, 25 Jun 2015 11:54:05 -0400
Subject: [PATCH] One way to work around the lack of
 html.parser.HTMLParserError in Python 3.5

---
 sphinx/builders/linkcheck.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
index 9f5c213..b05c5b2 100644
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -19,9 +19,19 @@
 from six.moves.urllib.request import build_opener, Request, HTTPRedirectHandler
 from six.moves.urllib.parse import unquote, urlsplit, quote
 from six.moves.urllib.error import HTTPError
-from six.moves.html_parser import HTMLParser, HTMLParseError
+from six.moves.html_parser import HTMLParser
 from docutils import nodes
 
+# 2015-06-25 barry@python.org.  This exception was deprecated in Python 3.3 and
+# removed in Python 3.5, however for backward compatibility reasons, we're not
+# going to just remove it.  If it doesn't exist, define an exception that will
+# never be caught but leaves the code in check_anchor() intact.
+try:
+    from six.moves.html_parser import HTMLParseError
+except ImportError:
+    class HTMLParseError(Exception):
+        pass
+
 from sphinx.builders import Builder
 from sphinx.util.console import purple, red, darkgreen, darkgray, \
     darkred, turquoise