summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@gmail.com>2017-03-03 03:20:00 (GMT)
committerGitHub <noreply@github.com>2017-03-03 03:20:00 (GMT)
commit398ff91ac0b8f4d930cd5d9e3e6a4bf247f810ef (patch)
tree574e40060c9c962fa87627af595ee540dbe33ab1 /Python
parent8d26aa930c0123933a1ceb12fceba4f5aef4e95e (diff)
downloadcpython-398ff91ac0b8f4d930cd5d9e3e6a4bf247f810ef.zip
cpython-398ff91ac0b8f4d930cd5d9e3e6a4bf247f810ef.tar.gz
cpython-398ff91ac0b8f4d930cd5d9e3e6a4bf247f810ef.tar.bz2
bpo-28893: Set __cause__ for errors in async iteration protocol (#407)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 4022ba2..49177d8 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1855,13 +1855,13 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
awaitable = _PyCoro_GetAwaitableIter(iter);
if (awaitable == NULL) {
- SET_TOP(NULL);
- PyErr_Format(
+ _PyErr_FormatFromCause(
PyExc_TypeError,
"'async for' received an invalid object "
"from __aiter__: %.100s",
Py_TYPE(iter)->tp_name);
+ SET_TOP(NULL);
Py_DECREF(iter);
goto error;
} else {
@@ -1920,7 +1920,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
awaitable = _PyCoro_GetAwaitableIter(next_iter);
if (awaitable == NULL) {
- PyErr_Format(
+ _PyErr_FormatFromCause(
PyExc_TypeError,
"'async for' received an invalid object "
"from __anext__: %.100s",