Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-19 10:32:46 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2020-04-19 10:34:54 +0300
commit52905782568ec88da2e19814b6a501f0947248f5 (patch)
tree896d0003fa424a6ba542506452e3bfed502543a4 /sphinx/roles.py
parent841f1c7e766d623d5c071605650bedc834480fd2 (diff)
Fix sphinx crashes with ImportError on python3.5.1
typing.Type was added since python 3.5.2. So it should be imported only on type checking.
Diffstat (limited to 'sphinx/roles.py')
-rw-r--r--sphinx/roles.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sphinx/roles.py b/sphinx/roles.py
index 862191831..ff24fcf55 100644
--- a/sphinx/roles.py
+++ b/sphinx/roles.py
@@ -11,7 +11,6 @@
import re
import warnings
from typing import Any, Dict, List, Tuple
-from typing import Type # for python3.5.1
from docutils import nodes, utils
from docutils.nodes import Element, Node, TextElement, system_message
@@ -29,6 +28,7 @@ from sphinx.util.typing import RoleFunction
if False:
# For type annotation
+ from typing import Type # for python3.5.1
from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
@@ -77,7 +77,7 @@ class XRefRole(ReferenceRole):
innernodeclass = nodes.literal # type: Type[TextElement]
def __init__(self, fix_parens: bool = False, lowercase: bool = False,
- nodeclass: Type[Element] = None, innernodeclass: Type[TextElement] = None,
+ nodeclass: "Type[Element]" = None, innernodeclass: "Type[TextElement]" = None,
warn_dangling: bool = False) -> None:
self.fix_parens = fix_parens
self.lowercase = lowercase