Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cpython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenVMS
Python
cpython
Commits
b286f9e6fe0b
Commit
b286f9e6fe0b
authored
5 years ago
by
Batuhan Taşkaya
Browse files
Options
Downloads
Patches
Plain Diff
bpo-38870: Throw ValueError on invalid yield from usage (GH-17798)
parent
12edceb2bde3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Lib/ast.py
+4
-4
4 additions, 4 deletions
Lib/ast.py
Lib/test/test_unparse.py
+2
-0
2 additions, 0 deletions
Lib/test/test_unparse.py
with
6 additions
and
4 deletions
Lib/ast.py
+
4
−
4
View file @
b286f9e6
...
@@ -736,8 +736,8 @@
...
@@ -736,8 +736,8 @@
def
visit_YieldFrom
(
self
,
node
):
def
visit_YieldFrom
(
self
,
node
):
with
self
.
delimit
(
"
(
"
,
"
)
"
):
with
self
.
delimit
(
"
(
"
,
"
)
"
):
self
.
write
(
"
yield from
"
)
self
.
write
(
"
yield from
"
)
if
node
.
value
:
if
not
node
.
value
:
self
.
write
(
"
"
)
raise
ValueError
(
"
Node can
'
t be used without a value attribute.
"
)
self
.
traverse
(
node
.
value
)
self
.
traverse
(
node
.
value
)
def
visit_Raise
(
self
,
node
):
def
visit_Raise
(
self
,
node
):
...
...
This diff is collapsed.
Click to expand it.
Lib/test/test_unparse.py
+
2
−
0
View file @
b286f9e6
...
@@ -278,6 +278,8 @@
...
@@ -278,6 +278,8 @@
def
test_invalid_set
(
self
):
def
test_invalid_set
(
self
):
self
.
check_invalid
(
ast
.
Set
(
elts
=
[]))
self
.
check_invalid
(
ast
.
Set
(
elts
=
[]))
def
test_invalid_yield_from
(
self
):
self
.
check_invalid
(
ast
.
YieldFrom
(
value
=
None
))
class
DirectoryTestCase
(
ASTTestCase
):
class
DirectoryTestCase
(
ASTTestCase
):
"""
Test roundtrip behaviour on all files in Lib and Lib/test.
"""
"""
Test roundtrip behaviour on all files in Lib and Lib/test.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment