You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2013-03-16.16:27:04.132>created_at=<Date2013-03-16.00:13:57.549>labels= ['interpreter-core']
title='str literals, which are not docstrings, should not be allowed between __future__ imports'updated_at=<Date2013-03-16.16:28:15.870>user='https://bugs.python.org/Arfrever'
test1.py shows that a str literal before first import from __future__ is a docstring.
test2.py shows that a str literal after first import from __future__ is not a docstring.
test2.py shows that if docstring is absent, then a single str literal between imports from __future__ does not cause SyntaxError, while it should.
test3.py shows that if docstring is present, then a str literal between imports from __future__ causes SyntaxError.
test4.py shows that if docstring is absent, then >=2 str literals between imports from __future__ cause SyntaxError.
$ cat test1.py
"some text"
from __future__ import absolute_import
print(__doc__)
$ cat test2.py
from __future__ import absolute_import
"some text"
from __future__ import print_function
print(__doc__)
$ cat test3.py
"some text 1"
from __future__ import absolute_import
"some text 2"
from __future__ import print_function
$ cat test4.py
from __future__ import absolute_import
"some text 1""some text 2"
from __future__ import print_function
$ python3.4 test1.py
some text
$ python3.4 test2.py
None
$ python3.4 test3.py
File "test3.py", line 4
from __future__ import print_function
^
SyntaxError: from __future__ imports must occur at the beginning of the file
$ python3.4 test4.py
File "test4.py", line 4
from __future__ import print_function
^
SyntaxError: from __future__ imports must occur at the beginning of the file
$
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: