[Jython-checkins] jython: Fix test_future.

frank.wierzbicki jython-checkins at python.org
Tue Mar 13 20:42:42 CET 2012


http://hg.python.org/jython/rev/bce3c8cd9f48
changeset:   6321:bce3c8cd9f48
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Tue Mar 13 12:42:35 2012 -0700
summary:
  Fix test_future.

files:
  grammar/Python.g |  15 +++++++++++++++
  1 files changed, 15 insertions(+), 0 deletions(-)


diff --git a/grammar/Python.g b/grammar/Python.g
--- a/grammar/Python.g
+++ b/grammar/Python.g
@@ -954,6 +954,21 @@
          }
         | LPAREN i2=import_as_names COMMA? RPAREN
          {
+             //XXX: this is almost a complete C&P of the code above - is there some way
+             //     to factor it out?
+             String dottedText = $dotted_name.text;
+             if (dottedText != null && dottedText.equals("__future__")) {
+                 List<alias> aliases = $i2.atypes;
+                 for(alias a: aliases) {
+                     if (a != null) {
+                         if (a.getInternalName().equals("print_function")) {
+                             printFunction = true;
+                         } else if (a.getInternalName().equals("unicode_literals")) {
+                             unicodeLiterals = true;
+                         }
+                     }
+                 }
+             }
              stype = new ImportFrom($FROM, actions.makeFromText($d, $dotted_name.names),
                  actions.makeModuleNameNode($d, $dotted_name.names),
                  actions.makeAliases($i2.atypes), actions.makeLevel($d));

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


More information about the Jython-checkins mailing list