summaryrefslogtreecommitdiff
path: root/sphinx/pycode/pgen2/driver.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-01-12 19:44:04 +0100
committerGeorg Brandl <georg@python.org>2014-01-12 19:44:04 +0100
commit42a8138c30ca2415c068f6dc19f9dbffddca0cac (patch)
treecbb620d934ef2edafacb2250d75fb7530f9b9b0b /sphinx/pycode/pgen2/driver.py
parent531d70989f318f0821061ff1224b2c8b97402a43 (diff)
downloadsphinx-git-42a8138c30ca2415c068f6dc19f9dbffddca0cac.tar.gz
Closes #1152: Fix pycode parsing errors of Python 3 code by including two grammar
versions for Python 2 and 3, and loading the appropriate version for the running Python version.
Diffstat (limited to 'sphinx/pycode/pgen2/driver.py')
-rw-r--r--sphinx/pycode/pgen2/driver.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sphinx/pycode/pgen2/driver.py b/sphinx/pycode/pgen2/driver.py
index e9e907dcc..422671dbc 100644
--- a/sphinx/pycode/pgen2/driver.py
+++ b/sphinx/pycode/pgen2/driver.py
@@ -122,7 +122,8 @@ def load_grammar(gt="Grammar.txt", gp=None,
if tail == ".txt":
tail = ""
# embed Sphinx major version for the case we ever change the grammar...
- gp = head + tail + ".".join(map(str, sphinx.version_info[:2])) + ".pickle"
+ gp = head + tail + "-sphinx" + \
+ ".".join(map(str, sphinx.version_info[:2])) + ".pickle"
if force or not _newer(gp, gt):
logger.info("Generating grammar tables from %s", gt)
g = pgen.generate_grammar(gt)