]> granicus.if.org Git - python/commitdiff
Fixed compiler module so __future__ print_function is compilable.
authorEric Smith <eric@trueblade.com>
Wed, 19 Mar 2008 02:11:30 +0000 (02:11 +0000)
committerEric Smith <eric@trueblade.com>
Wed, 19 Mar 2008 02:11:30 +0000 (02:11 +0000)
Lib/compiler/consts.py
Lib/compiler/future.py
Lib/compiler/pycodegen.py

index c79e814beb7defd5a74342e1b16fc3794a4c6df9..dd42793aa9d478c82d1ce83b25377fdf3455ce71 100644 (file)
@@ -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
index fef189e9e91dedbb27b39f7b9a66a5a020c1c339..d94fcddc7e29247b3337225fa074d5d13c01ccc2 100644 (file)
@@ -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
index 5d227b87fe87b50473ac2a0dd8ef043ffcd4945a..61b9fe9bb6edc62375886b334cadfcd96e8a4e63 100644 (file)
@@ -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"""