For Py3.5 embeddable, which misses pydoc_data module

This commit is contained in:
Uvview
2016-09-17 03:47:56 +04:00
committed by GitHub
parent be2a97cd36
commit e08209f35e

View File

@@ -8,8 +8,13 @@ from jedi.parser.tree import Leaf
try: try:
from pydoc_data import topics as pydoc_topics from pydoc_data import topics as pydoc_topics
except ImportError: except ImportError:
# Python 2.6 # Python 2
import pydoc_topics try:
import pydoc_topics
except ImportError:
# This is for Python 3 embeddable version, which dont have
# pydoc_data module in its file python3x.zip.
pydoc_topics = None
if is_py3: if is_py3:
if is_py35: if is_py35:
@@ -99,6 +104,9 @@ def imitate_pydoc(string):
It's not possible to get the pydoc's without starting the annoying pager It's not possible to get the pydoc's without starting the annoying pager
stuff. stuff.
""" """
if pydoc_topics is None:
return ''
# str needed because of possible unicode stuff in py2k (pydoc doesn't work # str needed because of possible unicode stuff in py2k (pydoc doesn't work
# with unicode strings) # with unicode strings)
string = str(string) string = str(string)