[Python-checkins] r61585 - python/trunk/Lib/compiler/consts.py python/trunk/Lib/compiler/future.py python/trunk/Lib/compiler/pycodegen.py

eric.smith python-checkins at python.org
Wed Mar 19 03:11:31 CET 2008


Author: eric.smith
Date: Wed Mar 19 03:11:30 2008
New Revision: 61585

Modified:
   python/trunk/Lib/compiler/consts.py
   python/trunk/Lib/compiler/future.py
   python/trunk/Lib/compiler/pycodegen.py
Log:
Fixed compiler module so __future__ print_function is compilable.

Modified: python/trunk/Lib/compiler/consts.py
==============================================================================
--- python/trunk/Lib/compiler/consts.py	(original)
+++ python/trunk/Lib/compiler/consts.py	Wed Mar 19 03:11:30 2008
@@ -19,3 +19,4 @@
 CO_FUTURE_DIVISION = 0x2000
 CO_FUTURE_ABSIMPORT = 0x4000
 CO_FUTURE_WITH_STATEMENT = 0x8000
+CO_FUTURE_PRINT_FUNCTION = 0x10000

Modified: python/trunk/Lib/compiler/future.py
==============================================================================
--- python/trunk/Lib/compiler/future.py	(original)
+++ python/trunk/Lib/compiler/future.py	Wed Mar 19 03:11:30 2008
@@ -16,7 +16,7 @@
 class FutureParser:
 
     features = ("nested_scopes", "generators", "division",
-                "absolute_import", "with_statement")
+                "absolute_import", "with_statement", "print_function")
 
     def __init__(self):
         self.found = {} # set

Modified: python/trunk/Lib/compiler/pycodegen.py
==============================================================================
--- python/trunk/Lib/compiler/pycodegen.py	(original)
+++ python/trunk/Lib/compiler/pycodegen.py	Wed Mar 19 03:11:30 2008
@@ -10,7 +10,7 @@
 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 @@
                 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"""


More information about the Python-checkins mailing list