Kaydet (Commit) 5d5c63f4 authored tarafından Eric Smith's avatar Eric Smith

Fixed compiler module so __future__ print_function is compilable.

üst b89a096d
...@@ -19,3 +19,4 @@ CO_GENERATOR_ALLOWED = 0 ...@@ -19,3 +19,4 @@ CO_GENERATOR_ALLOWED = 0
CO_FUTURE_DIVISION = 0x2000 CO_FUTURE_DIVISION = 0x2000
CO_FUTURE_ABSIMPORT = 0x4000 CO_FUTURE_ABSIMPORT = 0x4000
CO_FUTURE_WITH_STATEMENT = 0x8000 CO_FUTURE_WITH_STATEMENT = 0x8000
CO_FUTURE_PRINT_FUNCTION = 0x10000
...@@ -16,7 +16,7 @@ def is_future(stmt): ...@@ -16,7 +16,7 @@ def is_future(stmt):
class FutureParser: class FutureParser:
features = ("nested_scopes", "generators", "division", features = ("nested_scopes", "generators", "division",
"absolute_import", "with_statement") "absolute_import", "with_statement", "print_function")
def __init__(self): def __init__(self):
self.found = {} # set self.found = {} # set
......
...@@ -10,7 +10,7 @@ from compiler import pyassem, misc, future, symbols ...@@ -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 SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL
from compiler.consts import (CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS, from compiler.consts import (CO_VARARGS, CO_VARKEYWORDS, CO_NEWLOCALS,
CO_NESTED, CO_GENERATOR, CO_FUTURE_DIVISION, 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 from compiler.pyassem import TupleArg
# XXX The version-specific code can go, since this code only works with 2.x. # XXX The version-specific code can go, since this code only works with 2.x.
...@@ -218,6 +218,8 @@ class CodeGenerator: ...@@ -218,6 +218,8 @@ class CodeGenerator:
self.graph.setFlag(CO_FUTURE_ABSIMPORT) self.graph.setFlag(CO_FUTURE_ABSIMPORT)
elif feature == "with_statement": elif feature == "with_statement":
self.graph.setFlag(CO_FUTURE_WITH_STATEMENT) self.graph.setFlag(CO_FUTURE_WITH_STATEMENT)
elif feature == "print_function":
self.graph.setFlag(CO_FUTURE_PRINT_FUNCTION)
def initClass(self): def initClass(self):
"""This method is called once for each class""" """This method is called once for each class"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment