[Python-checkins] cpython (merge 3.4 -> default): merge 3.4

benjamin.peterson python-checkins at python.org
Thu Apr 10 06:25:12 CEST 2014


http://hg.python.org/cpython/rev/16f090d912d1
changeset:   90213:16f090d912d1
parent:      90210:6a4ef8928e1b
parent:      90211:094615256a54
user:        Benjamin Peterson <benjamin at python.org>
date:        Thu Apr 10 00:24:47 2014 -0400
summary:
  merge 3.4

files:
  Lib/lib2to3/Grammar.txt          |  3 ++-
  Lib/lib2to3/tests/test_parser.py |  7 +++++++
  Misc/NEWS                        |  2 ++
  3 files changed, 11 insertions(+), 1 deletions(-)


diff --git a/Lib/lib2to3/Grammar.txt b/Lib/lib2to3/Grammar.txt
--- a/Lib/lib2to3/Grammar.txt
+++ b/Lib/lib2to3/Grammar.txt
@@ -155,4 +155,5 @@
 # not used in grammar, but may appear in "node" passed from Parser to Compiler
 encoding_decl: NAME
 
-yield_expr: 'yield' [testlist]
+yield_expr: 'yield' [yield_arg]
+yield_arg: 'from' test | testlist
diff --git a/Lib/lib2to3/tests/test_parser.py b/Lib/lib2to3/tests/test_parser.py
--- a/Lib/lib2to3/tests/test_parser.py
+++ b/Lib/lib2to3/tests/test_parser.py
@@ -54,6 +54,13 @@
         self.validate("a @= b")
 
 
+class TestYieldFrom(GrammarTest):
+    def test_matrix_multiplication_operator(self):
+        self.validate("yield from x")
+        self.validate("(yield from x) + y")
+        self.invalid_syntax("yield from")
+
+
 class TestRaiseChanges(GrammarTest):
     def test_2x_style_1(self):
         self.validate("raise")
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -215,6 +215,8 @@
 Tools/Demos
 -----------
 
+- Add support for ``yield from`` to 2to3.
+
 - Add support for the PEP 465 matrix multiplication operator to 2to3.
 
 - Issue #16047: Fix module exception list and __file__ handling in freeze.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list