summaryrefslogtreecommitdiffstats
path: root/Lib/compiler
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2008-03-19 02:11:30 (GMT)
committerEric Smith <eric@trueblade.com>2008-03-19 02:11:30 (GMT)
commit5d5c63f462683e971a4a2d877e78946554aacbf3 (patch)
treec8756cd57516bc9a5eca62079e8137cb4ea7c292 /Lib/compiler
parentb89a096d6dce43dad60618750ea9c62f770b2e7a (diff)
downloadcpython-5d5c63f462683e971a4a2d877e78946554aacbf3.zip
cpython-5d5c63f462683e971a4a2d877e78946554aacbf3.tar.gz
cpython-5d5c63f462683e971a4a2d877e78946554aacbf3.tar.bz2
Fixed compiler module so __future__ print_function is compilable.
Diffstat (limited to 'Lib/compiler')
-rw-r--r--Lib/compiler/consts.py1
-rw-r--r--Lib/compiler/future.py2
-rw-r--r--Lib/compiler/pycodegen.py4
3 files changed, 5 insertions, 2 deletions
diff --git a/Lib/compiler/consts.py b/Lib/compiler/consts.py
index c79e814..dd42793 100644
--- a/Lib/compiler/consts.py
+++ b/Lib/compiler/consts.py
@@ -19,3 +19,4 @@ CO_GENERATOR_ALLOWED = 0
CO_FUTURE_DIVISION = 0x2000
CO_FUTURE_ABSIMPORT = 0x4000
CO_FUTURE_WITH_STATEMENT = 0x8000
+CO_FUTURE_PRINT_FUNCTION = 0x10000
diff --git a/Lib/compiler/future.py b/Lib/compiler/future.py
index fef189e..d94fcdd 100644
--- a/Lib/compiler/future.py
+++ b/Lib/compiler/future.py
@@ -16,7 +16,7 @@ def is_future(stmt):
class FutureParser:
features = ("nested_scopes", "generators", "division",
- "absolute_import", "with_statement")
+ "absolute_import", "with_statement", "print_function")
def __init__(self):
self.found = {} # set
diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
index 5d227b8..61b9fe9 100644
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -10,7 +10,7 @@ from compiler import pyassem, misc, future, symbols
from compiler.consts import SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL
from compiler.consts import (CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS,
CO_NESTED, CO_GENERATOR, CO_FUTURE_DIVISION,
- CO_FUTURE_ABSIMPORT, CO_FUTURE_WITH_STATEMENT)
+ CO_FUTURE_ABSIMPORT, CO_FUTURE_WITH_STATEMENT, CO_FUTURE_PRINT_FUNCTION)
from compiler.pyassem import TupleArg
# XXX The version-specific code can go, since this code only works with 2.x.
@@ -218,6 +218,8 @@ class CodeGenerator:
self.graph.setFlag(CO_FUTURE_ABSIMPORT)
elif feature == "with_statement":
self.graph.setFlag(CO_FUTURE_WITH_STATEMENT)
+ elif feature == "print_function":
+ self.graph.setFlag(CO_FUTURE_PRINT_FUNCTION)
def initClass(self):
"""This method is called once for each class"""