NULL and no exception set from tp_iternext means StopIteration
This commit is contained in:
parent
9a80fa81b0
commit
0296a56520
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue