[Python-checkins] r42617 - in python/trunk: Lib/compiler/future.py Misc/NEWS
martin.v.loewis
python-checkins at python.org
Mon Feb 27 20:56:31 CET 2006
Author: martin.v.loewis
Date: Mon Feb 27 20:56:30 2006
New Revision: 42617
Modified:
python/trunk/Lib/compiler/future.py
python/trunk/Misc/NEWS
Log:
Skip over doc strings.
Modified: python/trunk/Lib/compiler/future.py
==============================================================================
--- python/trunk/Lib/compiler/future.py (original)
+++ python/trunk/Lib/compiler/future.py Mon Feb 27 20:56:30 2006
@@ -22,7 +22,14 @@
def visitModule(self, node):
stmt = node.node
+ found_docstring = False
for s in stmt.nodes:
+ # Skip over docstrings
+ if not found_docstring and isinstance(s, ast.Discard) \
+ and isinstance(s.expr, ast.Const) \
+ and isinstance(s.expr.value, str):
+ found_docstring = True
+ continue
if not self.check_stmt(s):
break
@@ -50,7 +57,7 @@
return
if node.modname != "__future__":
return
- raise SyntaxError, "invalid future statement"
+ raise SyntaxError, "invalid future statement " + repr(node)
def find_futures(node):
p1 = FutureParser()
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Mon Feb 27 20:56:30 2006
@@ -393,6 +393,8 @@
Library
-------
+- The compiler package now supports future imports after the module docstring.
+
- Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
More information about the Python-checkins
mailing list