Commit 415ed937 authored by Martin v. Löwis's avatar Martin v. Löwis

Skip over doc strings.

parent b9eb5510
...@@ -22,7 +22,14 @@ class FutureParser: ...@@ -22,7 +22,14 @@ class FutureParser:
def visitModule(self, node): def visitModule(self, node):
stmt = node.node stmt = node.node
found_docstring = False
for s in stmt.nodes: 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): if not self.check_stmt(s):
break break
...@@ -50,7 +57,7 @@ class BadFutureParser: ...@@ -50,7 +57,7 @@ class BadFutureParser:
return return
if node.modname != "__future__": if node.modname != "__future__":
return return
raise SyntaxError, "invalid future statement" raise SyntaxError, "invalid future statement " + repr(node)
def find_futures(node): def find_futures(node):
p1 = FutureParser() p1 = FutureParser()
......
...@@ -393,6 +393,8 @@ Extension Modules ...@@ -393,6 +393,8 @@ Extension Modules
Library Library
------- -------
- The compiler package now supports future imports after the module docstring.
- Bug #1413790: zipfile now sanitizes absolute archive names that are - Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs. not allowed by the specs.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment