[pypy-svn] pypy compile-from-stream: Remove duplicate

amauryfa commits-noreply at bitbucket.org
Tue Mar 22 00:16:57 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: compile-from-stream
Changeset: r42837:ff651a2873a5
Date: 2011-03-21 23:51 +0100
http://bitbucket.org/pypy/pypy/changeset/ff651a2873a5/

Log:	Remove duplicate

diff --git a/pypy/interpreter/pycompiler.py b/pypy/interpreter/pycompiler.py
--- a/pypy/interpreter/pycompiler.py
+++ b/pypy/interpreter/pycompiler.py
@@ -119,7 +119,7 @@
             raise OperationError(self.space.w_TypeError, self.space.wrap(
                 "invalid node type"))
 
-        future_pos = misc.parse_future(node)
+        _, future_pos = future.get_futures(self.future_flags, node)
         info = pyparse.CompileInfo(filename, mode, flags, future_pos)
         return self._compile_ast(node, info)
 

diff --git a/pypy/interpreter/astcompiler/misc.py b/pypy/interpreter/astcompiler/misc.py
--- a/pypy/interpreter/astcompiler/misc.py
+++ b/pypy/interpreter/astcompiler/misc.py
@@ -27,33 +27,6 @@
     _emit_syntax_warning(space, w_msg, w_filename, w_lineno, w_offset)
 
 
-def parse_future(tree):
-    future_lineno = 0
-    future_column = 0
-    have_docstring = False
-    if isinstance(tree, ast.Module):
-        body = tree.body
-    elif isinstance(tree, ast.Interactive):
-        body = tree.body
-    else:
-        return 0, 0
-    for stmt in body:
-        if isinstance(stmt, ast.Expr) and isinstance(stmt.value, ast.Str):
-            if have_docstring:
-                break
-            else:
-                have_docstring = True
-        elif isinstance(stmt, ast.ImportFrom):
-            if stmt.module == "__future__":
-                future_lineno = stmt.lineno
-                future_column = stmt.col_offset
-            else:
-                break
-        else:
-            break
-    return future_lineno, future_column
-
-
 class ForbiddenNameAssignment(Exception):
 
     def __init__(self, name, node):


More information about the Pypy-commit mailing list