diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:31:06 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-03-02 16:31:06 (GMT) |
commit | d2dc15b26b03c03df664641fce544efa05588945 (patch) | |
tree | 1c30c4931ee089b9c8049224e20e3422136556cf /Python | |
parent | 5604446b3b0b127755aa93f13c49830eba43285d (diff) | |
parent | c724bae51cd0580cd493f319f3b14c2e1a28f3b6 (diff) | |
download | cpython-d2dc15b26b03c03df664641fce544efa05588945.zip cpython-d2dc15b26b03c03df664641fce544efa05588945.tar.gz cpython-d2dc15b26b03c03df664641fce544efa05588945.tar.bz2 |
Merge 3.5 (issue #25888)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 8904d7a..7b07475 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2021,6 +2021,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) Py_DECREF(iterable); + if (iter != NULL && PyCoro_CheckExact(iter)) { + PyObject *yf = _PyGen_yf((PyGenObject*)iter); + if (yf != NULL) { + /* `iter` is a coroutine object that is being + awaited, `yf` is a pointer to the current awaitable + being awaited on. */ + Py_DECREF(yf); + Py_CLEAR(iter); + PyErr_SetString( + PyExc_RuntimeError, + "coroutine is being awaited already"); + /* The code below jumps to `error` if `iter` is NULL. */ + } + } + SET_TOP(iter); /* Even if it's NULL */ if (iter == NULL) { |