Kaydet (Commit) 415ed937 authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Skip over doc strings.

üst b9eb5510
......@@ -22,7 +22,14 @@ class FutureParser:
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 @@ class BadFutureParser:
return
if node.modname != "__future__":
return
raise SyntaxError, "invalid future statement"
raise SyntaxError, "invalid future statement " + repr(node)
def find_futures(node):
p1 = FutureParser()
......
......@@ -393,6 +393,8 @@ Extension Modules
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.
......
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