[pypy-svn] r17390 - pypy/dist/pypy/interpreter/astcompiler

arigo at codespeak.net arigo at codespeak.net
Thu Sep 8 20:39:20 CEST 2005


Author: arigo
Date: Thu Sep  8 20:39:19 2005
New Revision: 17390

Modified:
   pypy/dist/pypy/interpreter/astcompiler/future.py
Log:
This logic was complaining on any "from import" statement that was
not at top-level.


Modified: pypy/dist/pypy/interpreter/astcompiler/future.py
==============================================================================
--- pypy/dist/pypy/interpreter/astcompiler/future.py	(original)
+++ pypy/dist/pypy/interpreter/astcompiler/future.py	Thu Sep  8 20:39:19 2005
@@ -66,13 +66,13 @@
             if isinstance(s, ast.From):
                 if s.valid_future:
                     continue
-                if s.modname != "__future__":
-                    continue
                 self.visitFrom(s)
             else:
                 self.default(s)
 
     def visitFrom(self, node):
+        if node.modname != "__future__":
+            return
         raise SyntaxError( "from __future__ imports must occur at the beginning of the file",
                            filename=node.filename,
                            lineno=node.lineno)



More information about the Pypy-commit mailing list