Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b7c9150b
Commit
b7c9150b
authored
Mar 12, 2017
by
Yury Selivanov
Committed by
GitHub
Mar 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix wrapping into StopIteration of return values in generators and coroutines (#644)
parent
2b27e2e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
Lib/test/test_coroutines.py
Lib/test/test_coroutines.py
+15
-0
Objects/genobject.c
Objects/genobject.c
+1
-2
No files found.
Lib/test/test_coroutines.py
View file @
b7c9150b
...
...
@@ -1103,6 +1103,21 @@ class CoroutineTest(unittest.TestCase):
"coroutine is being awaited already"
):
waiter
(
coro
).
send
(
None
)
def
test_await_16
(
self
):
# See https://bugs.python.org/issue29600 for details.
async
def
f
():
return
ValueError
()
async
def
g
():
try
:
raise
KeyError
except
:
return
await
f
()
_
,
result
=
run_async
(
g
())
self
.
assertIsNone
(
result
.
__context__
)
def
test_with_1
(
self
):
class
Manager
:
def
__init__
(
self
,
name
):
...
...
Objects/genobject.c
View file @
b7c9150b
...
...
@@ -574,8 +574,7 @@ _PyGen_SetStopIterationValue(PyObject *value)
PyObject
*
e
;
if
(
value
==
NULL
||
(
!
PyTuple_Check
(
value
)
&&
!
PyObject_TypeCheck
(
value
,
(
PyTypeObject
*
)
PyExc_StopIteration
)))
(
!
PyTuple_Check
(
value
)
&&
!
PyExceptionInstance_Check
(
value
)))
{
/* Delay exception instantiation if we can */
PyErr_SetObject
(
PyExc_StopIteration
,
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment