[Python-checkins] r61425 - sandbox/trunk/2to3/pgen2/driver.py
collin.winter
python-checkins at python.org
Sun Mar 16 16:19:56 CET 2008
Author: collin.winter
Date: Sun Mar 16 16:19:55 2008
New Revision: 61425
Modified:
sandbox/trunk/2to3/pgen2/driver.py
Log:
Emit a separate grammar pickle for each Python version. This gets around problems where a pickle file created under 2.x is read back incorrectly under 3.x.
Modified: sandbox/trunk/2to3/pgen2/driver.py
==============================================================================
--- sandbox/trunk/2to3/pgen2/driver.py (original)
+++ sandbox/trunk/2to3/pgen2/driver.py Sun Mar 16 16:19:55 2008
@@ -18,6 +18,7 @@
# Python imports
import os
import logging
+import sys
# Pgen imports
from pgen2 import grammar, parse, token, tokenize
@@ -119,7 +120,7 @@
head, tail = os.path.splitext(gt)
if tail == ".txt":
tail = ""
- gp = head + tail + ".pickle"
+ gp = head + tail + ".".join(map(str, sys.version_info)) + ".pickle"
if force or not _newer(gp, gt):
logger.info("Generating grammar tables from %s", gt)
from pgen2 import pgen
More information about the Python-checkins
mailing list