summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-11-16 23:16:32 (GMT)
committerYury Selivanov <yury@magic.io>2016-11-16 23:16:32 (GMT)
commitbb2356500c87cc0c6d90813b2e814181a8bac13d (patch)
treec5b70b5340330e4a26446f101ac8e21318bdaea1 /Objects
parent27b74244fbc42f4f50024f14b4b89e6219dedd98 (diff)
parent41782e497092a27efbae20208ce7d48c657e74cb (diff)
downloadcpython-bb2356500c87cc0c6d90813b2e814181a8bac13d.zip
cpython-bb2356500c87cc0c6d90813b2e814181a8bac13d.tar.gz
cpython-bb2356500c87cc0c6d90813b2e814181a8bac13d.tar.bz2
Merge 3.6 (issue #28721)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genobject.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c
index ddf72cc..558f809 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1931,9 +1931,17 @@ yield_close:
return NULL;
check_error:
- if (PyErr_ExceptionMatches(PyExc_StopAsyncIteration)
- || PyErr_ExceptionMatches(PyExc_GeneratorExit)
- ) {
+ if (PyErr_ExceptionMatches(PyExc_StopAsyncIteration)) {
+ o->agt_state = AWAITABLE_STATE_CLOSED;
+ if (o->agt_args == NULL) {
+ /* when aclose() is called we don't want to propagate
+ StopAsyncIteration; just raise StopIteration, signalling
+ that 'aclose()' is done. */
+ PyErr_Clear();
+ PyErr_SetNone(PyExc_StopIteration);
+ }
+ }
+ else if (PyErr_ExceptionMatches(PyExc_GeneratorExit)) {
o->agt_state = AWAITABLE_STATE_CLOSED;
PyErr_Clear(); /* ignore these errors */
PyErr_SetNone(PyExc_StopIteration);