diff options
author | Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com> | 2020-01-02 18:20:04 (GMT) |
---|---|---|
committer | Pablo Galindo <Pablogsal@gmail.com> | 2020-01-02 18:20:04 (GMT) |
commit | 7b35bef9787cd80ed1e12124f759b4be03c849db (patch) | |
tree | 6b9acbbb48a86fc49da74afc2c9a97f31373f6bc /Lib/ast.py | |
parent | 78018bb1621e5ecb61cba6e664d14ff789d2874c (diff) | |
download | cpython-7b35bef9787cd80ed1e12124f759b4be03c849db.zip cpython-7b35bef9787cd80ed1e12124f759b4be03c849db.tar.gz cpython-7b35bef9787cd80ed1e12124f759b4be03c849db.tar.bz2 |
bpo-38870: Throw ValueError on invalid yield from usage (GH-17798)
Diffstat (limited to 'Lib/ast.py')
-rw-r--r-- | Lib/ast.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -735,10 +735,10 @@ class _Unparser(NodeVisitor): def visit_YieldFrom(self, node): with self.delimit("(", ")"): - self.write("yield from") - if node.value: - self.write(" ") - self.traverse(node.value) + self.write("yield from ") + if not node.value: + raise ValueError("Node can't be used without a value attribute.") + self.traverse(node.value) def visit_Raise(self, node): self.fill("raise") |