[Jython-checkins] jython: #1920, #1921 compiler.py fixes. Thanks Arfrever!

frank.wierzbicki jython-checkins at python.org
Fri Jul 13 21:13:50 CEST 2012


http://hg.python.org/jython/rev/e0a776d3a03e
changeset:   6793:e0a776d3a03e
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Fri Jul 13 11:22:51 2012 -0700
summary:
  #1920, #1921 compiler.py fixes. Thanks Arfrever!

files:
  Lib/compiler/pycodegen.py |  11 ++++++++---
  NEWS                      |   2 ++
  2 files changed, 10 insertions(+), 3 deletions(-)


diff --git a/Lib/compiler/pycodegen.py b/Lib/compiler/pycodegen.py
--- a/Lib/compiler/pycodegen.py
+++ b/Lib/compiler/pycodegen.py
@@ -8,10 +8,11 @@
 
 from compiler import ast, parse, walk, syntax
 from compiler import misc, future, symbols
-from compiler.consts import SC_LOCAL, SC_GLOBAL, SC_FREE, SC_CELL
+from compiler.consts import SC_LOCAL, SC_GLOBAL_IMPLICIT, SC_GLOBAL_EXPLICT, \
+     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)
 if not is_jython:
     from compiler.pyassem import TupleArg
 else:
@@ -226,6 +227,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"""
@@ -288,7 +291,9 @@
                 self.emit(prefix + '_NAME', name)
             else:
                 self.emit(prefix + '_FAST', name)
-        elif scope == SC_GLOBAL:
+        elif scope == SC_GLOBAL_EXPLICT:
+            self.emit(prefix + '_GLOBAL', name)
+        elif scope == SC_GLOBAL_IMPLICIT:
             if not self.optimized:
                 self.emit(prefix + '_NAME', name)
             else:
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@
 
 Jython 2.7a3
   Bugs Fixed
+    - [ 1921 ] compiler module broken in Jython 2.7 
+    - [ 1920 ] Backport CO_FUTURE_PRINT_FUNCTION to Lib/compiler/pycodegen.py
     - [ 1914 ] Float formatting broken in many non-English locales in Jython 2.7
     - [ 1909 ] attrgetter does not parse dotted attributes
     - [ 1924 ] Implement operator.methodcaller

-- 
Repository URL: http://hg.python.org/jython


More information about the Jython-checkins mailing list