New issue 2701: Future imports not allowed after docstrings https://bitbucket.org/pypy/pypy/issues/2701/future-imports-not-allowed-after
Davide Depau: The [Python language reference](https://docs.python.org/2/reference/simple_stmts.html#future) clearly states that future statements are allowed after docstrings: > A future statement must appear near the top of the module. The only lines > that can appear before a future statement are: > > - the module docstring (if any), > - comments, > - blank lines, and > - other future statements. However PyPy seems not to like it very much. See my pull request to OctoPrint: https://github.com/foosel/OctoPrint/pull/2217 The fact that in some file there is a future import, a docstring and then another future import makes PyPy crash, while CPython accepts it just fine. ``` SyntaxError: __future__ statements must appear at beginning of file ``` Code that triggers it: ```python from __future__ import absolute_import """ [Module docstring] """ from __future__ import absolute_import, division, print_function ``` While this obviously the best code one could write (in fact they merged my PR that fixes it), it still valid and PyPy should accept it. _______________________________________________ pypy-issue mailing list pypy-issue@python.org https://mail.python.org/mailman/listinfo/pypy-issue