Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r93013:714cdd09fc99
Date: 2017-11-14 16:03 +0000
http://bitbucket.org/pypy/pypy/changeset/714cdd09fc99/
Log: backout b95f1240ad90: this was fixed in CPython 3.*
diff --git a/pypy/interpreter/pyparser/future.py
b/pypy/interpreter/pyparser/future.py
--- a/pypy/interpreter/pyparser/future.py
+++ b/pypy/interpreter/pyparser/future.py
@@ -87,17 +87,13 @@
# permissive parsing of the given list of tokens; it relies on
# the real parsing done afterwards to give errors.
it.skip_newlines()
+ it.skip_name("r") or it.skip_name("u") or it.skip_name("ru")
+ if it.skip(pygram.tokens.STRING):
+ it.skip_newlines()
- docstring_possible = True
- while True:
- it.skip_name("r") or it.skip_name("u") or it.skip_name("ru")
- if docstring_possible and it.skip(pygram.tokens.STRING):
- it.skip_newlines()
- docstring_possible = False
- if not (it.skip_name("from") and
+ while (it.skip_name("from") and
it.skip_name("__future__") and
it.skip_name("import")):
- break
it.skip(pygram.tokens.LPAR) # optionally
# return in 'last_position' any line-column pair that points
# somewhere inside the last __future__ import statement
diff --git a/pypy/interpreter/pyparser/test/test_future.py
b/pypy/interpreter/pyparser/test/test_future.py
--- a/pypy/interpreter/pyparser/test/test_future.py
+++ b/pypy/interpreter/pyparser/test/test_future.py
@@ -193,13 +193,3 @@
'from __future__ import with_statement;')
f = run(s, (2, 23))
assert f == 0
-
-def test_future_doc_future():
- # for some reason people do this :-[
- s = '''
-from __future__ import generators
-"Docstring"
-from __future__ import division
- '''
- f = run(s, (4, 24))
- assert f == 0
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit