Commit 0296a565 authored by Benjamin Peterson's avatar Benjamin Peterson

NULL and no exception set from tp_iternext means StopIteration

parent 9a80fa81
......@@ -831,6 +831,11 @@ class TestPEP380Operation(unittest.TestCase):
"Enter f",
])
def test_yield_from_empty(self):
def g():
yield from ()
self.assertRaises(StopIteration, next, g())
def test_main():
from test import support
......
......@@ -1839,7 +1839,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
if (!retval) {
/* iter may be exhausted */
Py_CLEAR(x);
if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {
if (PyErr_Occurred() &&
!PyErr_ExceptionMatches(PyExc_StopIteration)) {
/* some other exception */
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment