[Jython-checkins] jython: Allow print_function in import __future__ print_function, ...

frank.wierzbicki jython-checkins at python.org
Thu May 19 06:51:05 CEST 2011


http://hg.python.org/jython/rev/64f9685743f6
changeset:   6225:64f9685743f6
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Wed May 18 21:50:58 2011 -0700
summary:
  Allow print_function in import __future__ print_function, ...

files:
  grammar/Python.g |  12 ++++++++----
  1 files changed, 8 insertions(+), 4 deletions(-)


diff --git a/grammar/Python.g b/grammar/Python.g
--- a/grammar/Python.g
+++ b/grammar/Python.g
@@ -932,10 +932,14 @@
         | i1=import_as_names
          {
              String dottedText = $dotted_name.text;
-             String importText = $i1.text;
-             if (dottedText != null && dottedText.equals("__future__") &&
-                 importText != null && importText.equals("print_function")) {
-                 printStatement = false;
+             if (dottedText != null && dottedText.equals("__future__")) {
+                 List<alias> aliases = $i1.atypes;
+                 for(alias a: aliases) {
+                     if (a != null && a.getInternalName().equals("print_function")) {
+                         printStatement = false;
+                         break;
+                     }
+                 }
              }
              stype = new ImportFrom($FROM, actions.makeFromText($d, $dotted_name.names),
                  actions.makeModuleNameNode($d, $dotted_name.names),

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


More information about the Jython-checkins mailing list